#49263 [NEW]: SplObjectStorage fails to serialize references
| From: | m dot kurzyna at crystalpoint dot pl | Date: | Fri, 14 Aug 2009 20:46:21 +0000 |
| Subject: | #49263 [NEW]: SplObjectStorage fails to serialize references | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-141063@lists.php.net to get a copy of this message | ||
From: m dot kurzyna at crystalpoint dot pl
Operating system: Linux
PHP version: 5.3.0
PHP Bug Type: SPL related
Bug description: SplObjectStorage fails to serialize references
Description:
------------
splObjectStorage fails to keep objects stored properly when they are
internally referenced (see ["obj"]=> NULL in the dump).
Reproduce code:
---------------
$o1 = new stdClass;
$o2 = new stdClass;
$s = new splObjectStorage();
$s[$o1] = array('prev' => null, 'next' => $o2);
$s[$o2] = array('prev' => $o1, 'next' => null);
var_dump(unserialize(serialize($s)));
Expected result:
----------------
object(SplObjectStorage)#3 (1) {
["storage":"SplObjectStorage":private]=>
array(2) {
["000000003696c2e400000000eec51f06"]=>
array(2) {
["obj"]=>
object(stdClass)#1 (0) {
}
["inf"]=>
array(2) {
["prev"]=>
NULL
["next"]=>
object(stdClass)#2 (0) {
}
}
}
["000000003696c2e700000000eec51f06"]=>
array(2) {
["obj"]=>
object(stdClass)#2 (0) {
}
["inf"]=>
array(2) {
["prev"]=>
object(stdClass)#1 (0) {
}
["next"]=>
NULL
}
}
}
}
Actual result:
--------------
object(SplObjectStorage)#4 (1) {
["storage":"SplObjectStorage":private]=>
array(2) {
["000000003696c2e000000000eec51f06"]=>
array(2) {
["obj"]=>
object(stdClass)#5 (0) {
}
["inf"]=>
array(2) {
["prev"]=>
NULL
["next"]=>
object(stdClass)#6 (0) {
}
}
}
["000000003696c2e500000000593811c6"]=>
array(2) {
["obj"]=>
NULL
["inf"]=>
array(2) {
["prev"]=>
object(stdClass)#5 (0) {
}
["next"]=>
NULL
}
}
}
}
--
Edit bug report at http://bugs.php.net/?id=49263&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49263&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49263&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49263&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49263&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49263&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49263&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49263&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49263&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49263&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49263&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49263&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49263&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49263&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49263&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49263&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49263&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49263&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49263&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49263&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49263&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49263&r=mysqlcfg