Re: PHP5 : __sleep() and __wakeup()

From: Date: Thu, 12 Aug 2004 16:41:22 +0000
Subject: Re: PHP5 : __sleep() and __wakeup()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-193597@lists.php.net to get a copy of this message
* Thus wrote Frdric Hardy: > > class foo > { > private $var = 'var'; > ... > > function __sleep() > { > return array('var'); > } > } > > and php code like this : > > $myFoo = new foo(); > var_dump(serialize($myFoo)); > > the 'var' property was not serialized because it is protected !!! > However, if you do not defined __sleep() method, 'var' is serialized !!! > Conclusion : the programmer can not define properties wich must be > serialized, but the language can serialized all properties, even if they > are private or protected !!! > And if the prgrammer (me) want not to put in session all properties, it > is impossible !!! what version are you running? this works perfectly fine: string(26) "O:3:"foo":1:{s:3:"var";N;}" Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid!

« previous php.general (#193597) next »