#30826 [Opn->Csd]: Serialize using lowercase "r" for recursive references in some cases
| From: | iliaa@php.net | Date: | Thu, 18 Nov 2004 22:15:02 +0000 |
| Subject: | #30826 [Opn->Csd]: Serialize using lowercase "r" for recursive references in some cases | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-69238@lists.php.net to get a copy of this message | ||
ID: 30826
Updated by: iliaa@php.net
Reported By: jan at horde dot org
-Status: Open
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 4CVS-2004-11-18 (stable)
New Comment:
This bug has been fixed in CVS.
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:
------------------------------------------------------------------------
[2004-11-18 15:53:08] 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;}}}}}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30826&edit=1