ID:               49263
 Updated by:       col...@php.net
 Reported By:      m dot kurzyna at crystalpoint dot pl
-Status:           Assigned
+Status:           Closed
 Bug Type:         SPL related
 Operating System: Linux
 PHP Version:      5.3.0
 Assigned To:      colder
 New Comment:

This bug has been fixed in SVN.

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:
------------------------------------------------------------------------

[2009-10-06 13:34:58] s...@php.net

Automatic comment from SVN on behalf of colder
Revision: http://svn.php.net/viewvc/?view=revision&revision=289250
Log: Fix bug #49263 (Offset error when unserializing self-references in
SplObjectStorage)

------------------------------------------------------------------------

[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

Reply via email to