Re: Storing objects in sessions recursively
| From: | Stut | Date: | Mon, 27 Nov 2006 12:27:54 +0000 |
| Subject: | Re: Storing objects in sessions recursively | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-245178@lists.php.net to get a copy of this message | ||
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