Re: Storing objects in sessions recursively

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jochem Maas wrote:
this is wrong - the ctor is not called at all when unserializing, check this
code snippet:

php -r '
class Test { function __construct() { echo "foo\n"; } }
$t = new Test;
$s = serialize($t);
unset($t);
$u = unserialize($s);
'

this only outputs 'foo' once.

seems like whatever Dave's problem was it's actually down to
missing ctor args.

Indeed, my bad. When I think about it it actually doesn't make sense for it to be called. Seems to me like the OP needs to be using the __wakeup magic method to re-initialise his objects.

-Stut

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux