#46192 [NEW]: ArrayObject Serialization Problem

From: Date: Sun, 28 Sep 2008 10:40:42 +0000
Subject: #46192 [NEW]: ArrayObject Serialization Problem
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-129294@lists.php.net to get a copy of this message
From:             s dot tretter at szene1 dot at
Operating system: Linux
PHP version:      5.3.0alpha2
PHP Bug Type:     Scripting Engine problem
Bug description:  ArrayObject Serialization Problem

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


-- 
Edit bug report at http://bugs.php.net/?id=46192&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46192&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46192&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46192&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=46192&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=46192&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=46192&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=46192&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=46192&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=46192&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=46192&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=46192&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=46192&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=46192&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=46192&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=46192&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=46192&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=46192&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=46192&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=46192&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=46192&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#129294) next »