note 76639 rejected from language.oop5.magic by bjori

From: Date: Tue, 24 Jul 2007 11:10:21 +0000
Subject: note 76639 rejected from language.oop5.magic by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-128864@lists.php.net to get a copy of this message
Note Submitter: amir_abiri at ipcmedia dot com ---- And finally, there is an issue with __sleep() and private member variables: <?php class A { private $a; public function __construct() { $this->a = 1; } } class B extends A { protected $b; public function __construct() { parent::__construct(); $this->b = 2; } function __sleep() { return array('a', 'b'); } } serialize(new B); result: Notice: serialize(): "a" returned as member variable from __sleep() but does not exist in ... This creates a serious problem, if for any reason you want to serialize an object that inherits from an external library class that has private variables.

« previous php.notes (#128864) next »