Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class PDO2 {
- private $dsn, $username, $password;
- public function __construct($dsn, $username, $password)
- {
- $this->dsn = $dsn;
- $this->username = $username;
- $this->password = $password;
- }
- }
- class Connection
- {
- protected $link;
- private $dsn, $username, $password;
- public function __construct($dsn, $username, $password)
- {
- $this->dsn = $dsn;
- $this->username = $username;
- $this->password = $password;
- $this->connect();
- }
- private function connect()
- {
- $this->link = new PDO2($this->dsn, $this->username, $this->password);
- }
- public function __wakeup()
- {
- $this->connect();
- }
- }
- $c = new Connection('aaaa', 'bbb', 'ccc');
- $s = serialize($c);
- print_r($s);
- public function __sleep()
- {
- return array('dsn', 'username', 'PDO2');
- }
- Notice: serialize(): "PDO2" returned as member variable from __sleep() but does not exist in
- public function __sleep()
- {
- return array('dsn', 'username');
- }
Add Comment
Please, Sign In to add comment