php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30826 Serialize using lowercase "r" for recursive references in some cases
Submitted: 2004-11-18 15:53 UTC Modified: 2004-11-18 23:14 UTC
From: jan at horde dot org Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4CVS-2004-11-18 (stable) OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jan at horde dot org
New email:
PHP Version: OS:

 

 [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;}}}}}



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-18 23:14 UTC] iliaa@php.net
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.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 22 14:01:29 2025 UTC