Re: PHP 4.0 Bug #7844: object inside a session registered object is not restored correctly

From: Date: Thu, 16 Nov 2000 15:57:09 +0000
Subject: Re: PHP 4.0 Bug #7844: object inside a session registered object is not restored correctly
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-38346@lists.php.net to get a copy of this message
On 16 Nov 2000 mhaertl@weiden.de wrote: > From: mhaertl@weiden.de > Operating system: Linux > PHP version: 4.0.3pl1 > PHP Bug Type: *Session related > Bug description: object inside a session registered object is not restored correctly > > Since i updated to php-4.0.3pl1 from 4.0.1pl2 registering objects doesn't work correctly > for me. > > What i do is the following: > > - create a object "a" from a class "myclass" > - in the constructor myclass() i create a new object "x" $this->x from class > "innerclass" > - when i register my object "a" and restore it, i get an error when i try to call a > method of $this->x > in object "a" > > Here an Example. This works in php-4.0.1pl2 but not in php-4.0.3pl1 (You get an error when > pressing reload link) > > filename: index.php > > <?php > class myclass { > function myclass() { > $this->x = new innerobject; > } > function show() { > $this->x->go(); > } > } > > class innerobject { > function go() { > print "I'm in go() now!<br>"; > } > } > > session_register("a"); > > if (! is_object($a) ) { > $a = new myclass; > } > > $a->show(); > > ?> > <br> > <a href="index.php">reload</a> > ?> > Try the following: ... $a=new myclass; session_register("a"); ... -- Ignacio Vazquez-Abrams <ignacio@openservices.net>

« previous php.dev (#38346) next »