File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
serialize /
bug31402.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:04 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
Bug #31402 (unserialize() generates references when it should not)
--INI--
error_reporting=E_ALL&~E_STRICT&~E_DEPRECATED
--FILE--
<?php
class TestX {
var $i;
function __construct($i) {
$this->i = $i;
}
}
class TestY {
var $A = array();
var $B;
function __construct() {
$this->A[1] = new TestX(1);
$this->A[2] = & new TestX(2);
$this->A[3] = & $this->A[2];
$this->B = $this->A[1];
}
}
$before = new TestY();
$ser = serialize($before);
$after = unserialize($ser);
var_dump($before, $after);
?>
===DONE===
--EXPECTF--
object(TestY)#%d (2) {
["A"]=>
array(3) {
[1]=>
object(TestX)#%d (1) {
["i"]=>
int(1)
}
[2]=>
&object(TestX)#%d (1) {
["i"]=>
int(2)
}
[3]=>
&object(TestX)#%d (1) {
["i"]=>
int(2)
}
}
["B"]=>
object(TestX)#%d (1) {
["i"]=>
int(1)
}
}
object(TestY)#%d (2) {
["A"]=>
array(3) {
[1]=>
object(TestX)#%d (1) {
["i"]=>
int(1)
}
[2]=>
&object(TestX)#%d (1) {
["i"]=>
int(2)
}
[3]=>
&object(TestX)#%d (1) {
["i"]=>
int(2)
}
}
["B"]=>
object(TestX)#%d (1) {
["i"]=>
int(1)
}
}
===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>