PHP 4.0 Bug #6604: Restoration of object stored in session fails

From: Date: Thu, 07 Sep 2000 15:37:02 +0000
Subject: PHP 4.0 Bug #6604: Restoration of object stored in session fails
Groups: php.dev 
Request: Send a blank email to php-dev+get-32563@lists.php.net to get a copy of this message
From: balazs.pataki@sztaki.hu Operating system: SunOS 5.7 PHP version: 4.0.2 PHP Bug Type: *Session related Bug description: Restoration of object stored in session fails The following script causes an error, like: Fatal error: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition test of the object you are trying to operate on was loaded _before_ the session was started in /dsd2/www/htdocs/cow/test.php on line 12 The script: <? class test { var $x; } session_register ("sessVar"); if ($sessVar == null) { $sessVar = new test(); $sessVar->x = "foo"; echo "foo set. Reload!"; } else { echo $sessVar->x; } ?> Here we tried to store a simple object in the session. The first time the script is invoked it creates a new test object and echos "foo set. Reload!". Then, reloading the script causes the error message shown above. Sessions with normal (not objects) variables work OK. This script fails with 4.0.1pl2 as well.

« previous php.dev (#32563) next »