PHP 4.0 Bug #5402: unserializing "stdClass" objects gives error
| From: | east at canit dot se | Date: | Thu, 06 Jul 2000 13:37:15 +0000 |
| Subject: | PHP 4.0 Bug #5402: unserializing "stdClass" objects gives error | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-23571@lists.php.net to get a copy of this message | ||
From: east@canit.se
Operating system: Linux
PHP version: 4.0.1pl2
PHP Bug Type: Scripting Engine problem
Bug description: unserializing "stdClass" objects gives error
in PHP 4.0.1pl2 something seems to be broke regarding serializing objects of type
"stdClass".
A class with an object of type "stdClass" cannot be unserialized and used.
The following example WONT work:
class Foo
{
var $object;
function Foo()
{
$object = mysql_fetch_object($result);
}
}
/* code */
$myfoo = new MyFoo();
$s_myfoo = serialize($myfoo);
$newfoo = new MyFoo();
$newfoo = unserialize($s_myfoo);
/***************/
echo $newfoo->object->what_ever;
gives the following error
"The script tried to execute a method or access a property of an incomplete object" - even
though "stdClass" definition exists and is loaded.