Bug #63163 [Opn->Dup]: Unserialisation incorrect in presented scenario
| From: | nikic@php.net | Date: | Sun, 01 Jan 2017 11:47:25 +0000 |
| Subject: | Bug #63163 [Opn->Dup]: Unserialisation incorrect in presented scenario | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206270@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
Updated by: nikic@php.net
Reported by: james at gadgets4vista dot co dot uk
Summary: Unserialisation incorrect in presented scenario
-Status: Open
+Status: Duplicate
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:
Closing as duplicate of newer bug #66085, which has more discussion about the root cause.
Previous Comments:
------------------------------------------------------------------------
[2014-09-09 06:59:05] turneliusz at gmail dot com
Fixed in PHP7 and HVVM http://3v4l.org/WPdtA
------------------------------------------------------------------------
[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