ID: 49263 Updated by: col...@php.net Reported By: m dot kurzyna at crystalpoint dot pl -Status: Open +Status: Assigned Bug Type: SPL related Operating System: Linux PHP Version: 5.3.0 -Assigned To: +Assigned To: colder
Previous Comments: ------------------------------------------------------------------------ [2009-08-14 20:46:20] m dot kurzyna at crystalpoint dot pl 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 this bug report at http://bugs.php.net/?id=49263&edit=1