#30826 [NEW]: Serialize using lowercase "r" for recursive references in some cases

From: Date: Thu, 18 Nov 2004 14:53:08 +0000
Subject: #30826 [NEW]: Serialize using lowercase "r" for recursive references in some cases
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-69213@lists.php.net to get a copy of this message
From: jan at horde dot org Operating system: Linux PHP version: 4CVS-2004-11-18 (stable) PHP Bug Type: Scripting Engine problem Bug description: Serialize using lowercase "r" for recursive references in some cases 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 bug report at http://bugs.php.net/?id=30826&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30826&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30826&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30826&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30826&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30826&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30826&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30826&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30826&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30826&r=support Expected behavior: http://bugs.php.net/fix.php?id=30826&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30826&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30826&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30826&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30826&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30826&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30826&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30826&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30826&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30826&r=mysqlcfg

« previous php.bugs (#69213) next »