I'am using php 5.0.0 release.

Try this :
var_dump($test);
var_dump(unserialize(serialize($test)));

You should obtain something like that for fist var_dump :

object test
        string test -> 'var'

and for the second var_dump :

object test
        string test -> 'var'
        string test -> & null

Best regards

Fred

PS : I can not test my code in 'live', because I have currently no php5 available (it is on my laptop, and i can not use it at work).
So, perhaps that my example is wrong :-(.
but in some case, i'am sure that __sleep() and __wakeup does not work correctly !!


Curt Zirzow wrote:

* 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

-- =================================================================== Frederic HARDY Email: [EMAIL PROTECTED] HEXANET SARL URL: http://www.hexanet.fr/ ZAC Les Charmilles Tel: +33 (0)3 26 79 30 05 3, allée Thierry Sabine Direct: +33 (0)3 26 61 77 84 BP 202 - 51686 REIMS CEDEX 2 FRANCE ===================================================================

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to