#39836 [Asn->Csd]: SplObjectStorage empty after unserialize
| From: | helly@php.net | Date: | Thu, 08 Feb 2007 22:14:36 +0000 |
| Subject: | #39836 [Asn->Csd]: SplObjectStorage empty after unserialize | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-108600@lists.php.net to get a copy of this message | ||
ID: 39836
Updated by: helly@php.net
Reported By: doublecompile at gmail dot com
-Status: Assigned
+Status: Closed
Bug Type: Feature/Change Request
Operating System: *
-PHP Version: 5.2.0
+PHP Version: 5.2.1
Assigned To: helly
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-12-16 13:56:05] helly@php.net
Works in HEAD now, except for unicode mode. Support in 5.2 might be
added as well. The patch at least works.
------------------------------------------------------------------------
[2006-12-16 12:31:37] helly@php.net
Actually this is a feature request. Overloaded objects are typically
not serializable even though PHP in theory has everything to allow
that.
------------------------------------------------------------------------
[2006-12-14 22:12:46] doublecompile at gmail dot com
Description:
------------
I serialized a SplObjectStorage instance containing several objects.
After unserialization, the SplObjectStorage object contained nothing.
It doesn't say in the SPL documentation that SplObjectStorage cannot be
serialized.
Reproduce code:
---------------
<?php
class test { }
$storage = new SplObjectStorage();
for( $i=0; $i<5; $i++ ) {
$test = new test();
$test->example = 'testing'.$i;
$storage->attach( $test );
}
echo "Before: ".count($storage)."<br>";
$str = serialize($storage);
$storage2 = unserialize( $str );
echo "After: ".count($storage2)."<br>";
?>
Expected result:
----------------
Before: 5
After: 5
Actual result:
--------------
Before: 5
After: 0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39836&edit=1