|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-10-06 13:34 UTC] svn@php.net
[2009-10-06 13:35 UTC] colder@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 15 00:00:02 2025 UTC |
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 } } } }