From: tolkad dot freenode at gmail dot com
Operating system: All
PHP version: 5.2.12
PHP Bug Type: Arrays related
Bug description: Array does not serialize properly
Description:
------------
When certain strings are unserialized they do not reserialize properly.
Reproduce code:
---------------
<?php
$x = array();
$x[] = &$x;
var_dump($x);
$z = serialize($x);
echo $z . "\n";
var_dump(unserialize($z));
echo "\n\n\n";
$x = unserialize("a:1:{i:0;R:1;}");
var_dump($x);
$z = serialize($x);
echo $z . "\n\n";
var_dump(unserialize($z));
Expected result:
----------------
array(1) {
[0]=>
&array(1) {
[0]=>
&array(1) {
[0]=>
*RECURSION*
}
}
}
a:1:{i:0;a:1:{i:0;R:2;}}
array(1) {
[0]=>
&array(1) {
[0]=>
&array(1) {
[0]=>
*RECURSION*
}
}
}
array(1) {
[0]=>
&array(1) {
[0]=>
&array(1) {
[0]=>
*RECURSION*
}
}
}
a:1:{i:0;R:1;}
array(1) {
[0]=>
&array(1) {
[0]=>
&array(1) {
[0]=>
*RECURSION*
}
}
}
Actual result:
--------------
array(1) {
[0]=>
&array(1) {
[0]=>
&array(1) {
[0]=>
*RECURSION*
}
}
}
a:1:{i:0;a:1:{i:0;R:2;}}
array(1) {
[0]=>
&array(1) {
[0]=>
&array(1) {
[0]=>
*RECURSION*
}
}
}
array(1) {
[0]=>
array(1) {
[0]=>
array(1) {
[0]=>
*RECURSION*
}
}
}
a:1:{i:0;a:1:{i:0;a:1:{i:0;N;}}}
array(1) {
[0]=>
array(1) {
[0]=>
array(1) {
[0]=>
NULL
}
}
}
--
Edit bug report at http://bugs.php.net/?id=50775&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50775&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50775&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50775&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50775&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50775&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50775&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50775&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50775&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50775&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50775&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50775&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50775&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50775&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50775&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50775&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50775&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50775&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50775&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50775&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50775&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50775&r=mysqlcfg