php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46192 ArrayObject Serialization Problem
Submitted: 2008-09-28 10:40 UTC Modified: 2008-09-29 22:44 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: s dot tretter at szene1 dot at Assigned: colder (profile)
Status: Closed Package: SPL related
PHP Version: 5.3.0alpha2 OS: Linux
Private report: No CVE-ID: None
 [2008-09-28 10:40 UTC] s dot tretter at szene1 dot at
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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-29 22:44 UTC] colder@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC