Bug #63163 [NEW]: Unserialisation incorrect in presented scenario
| From: | james at gadgets4vista dot co dot uk | Date: | Tue, 25 Sep 2012 19:49:41 +0000 |
| Subject: | Bug #63163 [NEW]: Unserialisation incorrect in presented scenario | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-173717@lists.php.net to get a copy of this message | ||
From: james at gadgets4vista dot co dot uk
Operating system: OS X 10.8.2
PHP version: 5.4.7
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Unserialisation incorrect in presented scenario
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 bug report at https://bugs.php.net/bug.php?id=63163&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63163&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63163&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63163&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63163&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63163&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63163&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63163&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63163&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63163&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63163&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=63163&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=63163&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63163&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63163&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63163&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63163&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63163&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63163&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63163&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63163&r=mysqlcfg