Re: Storing objects in sessions recursively

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

 



Stut wrote:
> 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

"it's" should have been "it's not" :-P

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

yeah, that would probably be the way to go - it's hard to tell without
seeing/knowing what the ctor/init routine was doing.

heck it's monday what you expect ;-) (I have the same excuse for fridays)

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