cvs: php-src(PHP_4_3) /ext/standard/tests/serialize bug31402.phpt
| From: | Jani Taskinen | Date: | Tue, 18 Jan 2005 11:37:37 +0000 |
| Subject: | cvs: php-src(PHP_4_3) /ext/standard/tests/serialize bug31402.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-29954@lists.php.net to get a copy of this message | ||
sniper Tue Jan 18 06:37:37 2005 EDT
Added files: (Branch: PHP_4_3)
/php-src/ext/standard/tests/serialize bug31402.phpt
Log:
MFH: Add test for bug #31402
http://cvs.php.net/co.php/php-src/ext/standard/tests/serialize/bug31402.phpt?r=1.1&p=1
Index: php-src/ext/standard/tests/serialize/bug31402.phpt
+++ php-src/ext/standard/tests/serialize/bug31402.phpt
--TEST--
Bug #31402 (unserialize() generates references when it should not)
--FILE--
<?php
class X {
var $i;
function X($i) {
$this->i = $i;
}
}
class Y {
var $A = array();
var $B;
function Y() {
$this->A[1] = new X(1);
$this->A[2] = new X(2);
$this->B = $this->A[1];
}
}
$before = new Y();
$ser = serialize($before);
$after = unserialize($ser);
var_dump($before, $after);
?>
--EXPECT--
object(y)(2) {
["A"]=>
array(2) {
[1]=>
object(x)(1) {
["i"]=>
int(1)
}
[2]=>
object(x)(1) {
["i"]=>
int(2)
}
}
["B"]=>
object(x)(1) {
["i"]=>
int(1)
}
}
object(y)(2) {
["A"]=>
array(2) {
[1]=>
&object(x)(1) {
["i"]=>
int(1)
}
[2]=>
object(x)(1) {
["i"]=>
int(2)
}
}
["B"]=>
&object(x)(1) {
["i"]=>
int(1)
}
}