#26737 [NoF->Opn]: unexpected __sleep() serialization behavior
| From: | rob at cue dot cc | Date: | Wed, 07 Jan 2004 01:53:49 +0000 |
| Subject: | #26737 [NoF->Opn]: unexpected __sleep() serialization behavior | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-52905@lists.php.net to get a copy of this message | ||
ID: 26737
User updated by: rob at cue dot cc
Reported By: rob at cue dot cc
-Status: No Feedback
+Status: Open
Bug Type: Zend Engine 2 problem
Operating System: *
PHP Version: 5CVS
New Comment:
will compile from cvs soon, and check for bug.
Previous Comments:
------------------------------------------------------------------------
[2004-01-06 20:51:56] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
------------------------------------------------------------------------
[2003-12-30 20:11:12] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2003-12-29 00:20:44] rob at cue dot cc
Description:
------------
I have an object instance ($obj_root) that I want to
persist in a
session.
The object's class (object_container) defines the
__sleep() function, and
returns the array of member variables to be serialized.
function __sleep()
{
return array("objs");
}
The member variable 'objs' ($this->objs = array('foo');)
is not serialized as expected;
Arrays or other object-types result in null strings.
Upon comparing the serialized instance strings, I have
discovered that the string-ified names of the member
variables are very different:
serialize() without __sleep() wraps null chars around
the instance class name, followed by the member variable
name.
obj_root|O:16:"object_container":1:{s:
22:"^@object_container^@objs";a:1:{s:3:"foo" ....
serialize() with __sleep() uses the plain member
variable name, and dismisses it as null.
If I use the __sleep() function and supply the member
variable name with null chars quoting the class name the
serialization works.
function __sleep()
{
return array("\0object_container\0objs");
}
Could this be a bug, or should the documentation be
updated to reflect this curious behaviour of __sleep().
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26737&edit=1