Serialize using lowercase "r" for recursive references in some cases
[2004-11-18 15:53 UTC] jan at horde dot org
Description:
------------
See the attached test script.
If you use
$file->a[0] = &$log;
instead of
$file->a[0] = $log;
everything works fine and you can unserialize the string. But the serialization with the lowercase "r" throws an error when during unserialization.
Reproduce code:
---------------
--TEST--
Bug # (Wrong serialization of objects with recursive references)
--FILE--
<?php
$rep = new stdClass;
$file = new stdClass;
$log = new stdClass;
$file->rep = &$rep;
$log->file = &$file;
$file->a[0] = $log;
echo serialize($file);
?>
--EXPECT--
O:8:"stdClass":2:{s:3:"rep";O:8:"stdClass":0:{}s:1:"a";a:1:{i:0;O:8:"stdClass":1:{s:4:"file";O:8:"stdClass":2:{s:3:"rep";R:2;s:1:"a";a:1:{i:0;R:4;}}}}}