Bug #63163 [Com]: Unserialisation incorrect in presented scenario

From: Date: Tue, 09 Sep 2014 06:59:06 +0000
Subject: Bug #63163 [Com]: Unserialisation incorrect in presented scenario
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187465@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63163&edit=1 ID: 63163 Comment by: turneliusz at gmail dot com Reported by: james at gadgets4vista dot co dot uk Summary: Unserialisation incorrect in presented scenario Status: Open Type: Bug Package: Scripting Engine problem Operating System: OS X 10.8.2 PHP Version: 5.4.7 Block user comment: N Private report: N New Comment: Fixed in PHP7 and HVVM http://3v4l.org/WPdtA Previous Comments: ------------------------------------------------------------------------ [2012-09-25 19:49:41] james at gadgets4vista dot co dot uk Description: ------------ So far as I can tell this problem is trigged by the serialisation/deserialisation going on in the inheritance hierarchy (ParentA and ParentB) in combination with the re-use (triggering obj references in the serialisation) of ParentB's children in Wrapper. At a guess this is a difference in the table construction between serialize and unserialize (thus ending up referencing the incorrect thing), but I haven't yet taken a look at their implementation so that's a total stab in the dark. Test script: --------------- http://pastie.org/private/vbjpi8ytmqqxi2pkiizatw Expected result: ---------------- object(Wrapper)#6 (2) { ["parent"]=> object(ParentB)#7 (2) { ["collection"]=> array(3) { [0]=> object(Child)#8 (1) { ["property"]=> string(3) "foo" } [1]=> object(Child)#9 (1) { ["property"]=> string(3) "foo" } [2]=> object(Child)#10 (1) { ["property"]=> string(3) "foo" } } ["rofl"]=> string(3) "foo" } ["children"]=> array(3) { [0]=> object(Child)#8 (1) { ["property"]=> string(3) "foo" } [1]=> object(Child)#9 (1) { ["property"]=> string(3) "foo" } [2]=> object(Child)#10 (1) { ["property"]=> string(3) "foo" } } } Actual result: -------------- object(Wrapper)#6 (2) { ["parent"]=> object(ParentB)#7 (2) { ["collection"]=> array(3) { [0]=> object(Child)#8 (1) { ["property"]=> string(3) "foo" } [1]=> object(Child)#9 (1) { ["property"]=> string(3) "foo" } [2]=> object(Child)#10 (1) { ["property"]=> string(3) "foo" } } ["rofl"]=> string(3) "foo" } ["children"]=> array(3) { [0]=> object(Child)#9 (1) { <-- Where'd #8 go? ["property"]=> string(3) "foo" } [1]=> object(Child)#10 (1) { ["property"]=> string(3) "foo" } [2]=> string(20) "1Y" <-- Unexpected } } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63163&edit=1

« previous php.bugs (#187465) next »