Bug #66292 [NEW]: Serializable interface implementation returns recursive when object serialized

From: Date: Fri, 13 Dec 2013 21:39:29 +0000
Subject: Bug #66292 [NEW]: Serializable interface implementation returns recursive when object serialized
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183324@lists.php.net to get a copy of this message
From: will at johnstonclan dot net Operating system: Mac OS X 10.9 PHP version: 5.5.7 Package: Scripting Engine problem Bug Type: Bug Bug description:Serializable interface implementation returns recursive when object serialized Description: ------------ When a class is created which implements Serializable, and the serialize method instantiates another class which is then serialized and returned, and several instances of the first class are created in an array, and then entire array is serialized, instances after the first one are considered recursive. If this is unserialized, PHP segfaults. Test script: --------------- https://gist.github.com/will-in-wi/7951652 If you uncomment the last line, the entire script segfaults. Expected result: ---------------- a:9:{i:0;C:10:"HelloWorld":39:{O:6:"Simple":1:{s:4:"test";s:4:"str1";}}i:1;C:10:"HelloWorld":4:{O:6:"Simple":1:{s:4:"test";s:4:"str2";}}i:2;C:10:"HelloWorld":4:{O:6:"Simple":1:{s:4:"test";s:4:"str3";}}i:3;C:10:"HelloWorld":4:{O:6:"Simple":1:{s:4:"test";s:4:"str4";}}i:4;C:10:"HelloWorld":4:{O:6:"Simple":1:{s:4:"test";s:4:"str5";}}i:5;C:10:"HelloWorld":4:{O:6:"Simple":1:{s:4:"test";s:4:"str6";}}i:6;C:10:"HelloWorld":4:{O:6:"Simple":1:{s:4:"test";s:4:"str7";}}i:7;C:10:"HelloWorld":4:{O:6:"Simple":1:{s:4:"test";s:4:"str8";}}i:8;C:10:"HelloWorld":4:{O:6:"Simple":1:{s:4:"test";s:4:"str9";}}} Actual result: -------------- a:9:{i:0;C:10:"HelloWorld":39:{O:6:"Simple":1:{s:4:"test";s:4:"str1";}}i:1;C:10:"HelloWorld":4:{r:3;}i:2;C:10:"HelloWorld":4:{r:3;}i:3;C:10:"HelloWorld":4:{r:3;}i:4;C:10:"HelloWorld":4:{r:3;}i:5;C:10:"HelloWorld":4:{r:3;}i:6;C:10:"HelloWorld":4:{r:3;}i:7;C:10:"HelloWorld":4:{r:3;}i:8;C:10:"HelloWorld":4:{r:3;}} -- Edit bug report at https://bugs.php.net/bug.php?id=66292&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66292&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66292&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66292&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=66292&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=66292&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=66292&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=66292&r=needscript Try newer version: https://bugs.php.net/fix.php?id=66292&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=66292&r=support Expected behavior: https://bugs.php.net/fix.php?id=66292&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=66292&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=66292&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=66292&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66292&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=66292&r=dst IIS Stability: https://bugs.php.net/fix.php?id=66292&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=66292&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=66292&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=66292&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=66292&r=mysqlcfg

« previous php.bugs (#183324) next »