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

From: Date: Fri, 13 Dec 2013 21:40:49 +0000
Subject: Bug #66292 [Com]: Serializable interface implementation returns recursive when object serialized
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183325@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66292&edit=1 ID: 66292 Comment by: will at johnstonclan dot net Reported by: will at johnstonclan dot net Summary: Serializable interface implementation returns recursive when object serialized Status: Open Type: Bug Package: Scripting Engine problem Operating System: Mac OS X 10.9 PHP Version: 5.5.7 Block user comment: N Private report: N New Comment: This might be related to #36424. Since that bug has been fixed for a while, I opted to open a new one. Previous Comments: ------------------------------------------------------------------------ [2013-12-13 21:39:28] will at johnstonclan dot net 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 this bug report at https://bugs.php.net/bug.php?id=66292&edit=1

« previous php.bugs (#183325) next »