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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2019 The PHP Group
All rights reserved.
Last updated: Sat Sep 21 01:01:26 2019 UTC