Hello !

I have a problem with __sleep() and __wakeup() with php 5.0.0.

if you have a class like that :

class foo
{
    private $var = 'var';

    function __construct()
    {
        ...
    }

    function __sleep()
    {
        return array('var');
    }

    function wakeup()
    {
    }
}

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 !!!


Any solutions ?

Best regards,

Fred

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



Reply via email to