|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-09-29 22:44 UTC] colder@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 08:00:01 2025 UTC |
Description: ------------ A ArrayObject containing a second ArrayObject cannot be unserialized. The serialization differs from php5.2 to php5.3: php5.3 C:11:"ArrayObject":180:{ x:i:0;C:11:"ArrayObject":140:{ x:i:0;a:5:{ s:4:"date";i:1222539347; s:7:"session";s:13:"geF9ndWVzdF8w"; s:5:"style";i:1; s:7:"friends";i:0; s:12:"friends_list";a:0:{} }; m:a:0:{} }; m:a:0:{}} php5.2 O:11:"ArrayObject":5:{ s:4:"date";i:1222539347; s:7:"session";s:13:"geF9ndWVzdF8w"; s:5:"style";i:1; s:7:"friends"; i:0;s:12:"friends_list";a:0:{} } Reproduce code: --------------- $useronline = new ArrayObject( new ArrayObject( array('date'=>1222539347, 'session'=>'geF9ndWVzdF8w', 'style'=>1, 'friends'=>0, 'friends_list'=>array() ) ) ); print_r($useronline);echo "\n"; $r = serialize($useronline); echo $r."\n"; print_r(unserialize($r)); Expected result: ---------------- should work like in php 5.2 Actual result: -------------- Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Error at offset 6 of 180 bytes' in test.php:18 Stack trace: #0 [internal function]: ArrayObject->unserialize('x:i:0;C:11:"Arr...') #1 test.php(18): unserialize('C:11:"ArrayObje...') #2 {main} thrown in test.php on line 18