Re: [PHP4BETA] Sessions and Objects

From: Date: Fri, 19 May 2000 13:13:30 +0000
Subject: Re: [PHP4BETA] Sessions and Objects
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-15237@lists.php.net to get a copy of this message
On Thu, 18 May 2000, Dave wrote: > I just started looking again at using objects in sessions and it appears > with the latest RC that object serialization does not support serialization > of methods yet...not that I ever heard that it would..or not. > > I caught somewhere that since PHP serialization does support object > properties that if the class is defined before a session_start() that you > should be able to have the entire object back...including methods...is this > the case? or no? Yes, it is possible. Example: <? # save session include "foo.class.php"; session_start(); session_register("a"); $a = new foo; $a->bar = 10; ?> <? # restore session include "foo.class.php"; session_start(); var_dump($a); ?> The second piece of code should print out your class and the methods should be available. -Andrei The church is near but the road is icy; the bar is far away but I will walk carefully. -- Russian proverb

« previous php.version4 (#15237) next »