mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
- Allow to work under php 5
This commit is contained in:
parent
df56c39bda
commit
04a08c757a
@ -1,71 +1,73 @@
|
||||
--TEST--
|
||||
Bug #31402 (unserialize() generates references when it should not)
|
||||
--INI--
|
||||
error_reporting=E_ALL&~E_STRICT
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class X {
|
||||
class TestX {
|
||||
var $i;
|
||||
|
||||
function X($i) {
|
||||
function __construct($i) {
|
||||
$this->i = $i;
|
||||
}
|
||||
}
|
||||
|
||||
class Y {
|
||||
class TestY {
|
||||
var $A = array();
|
||||
var $B;
|
||||
|
||||
function Y() {
|
||||
$this->A[1] = new X(1);
|
||||
$this->A[2] = new X(2);
|
||||
function __construct() {
|
||||
$this->A[1] = new TestX(1);
|
||||
$this->A[2] = new TestX(2);
|
||||
$this->B = $this->A[1];
|
||||
}
|
||||
}
|
||||
|
||||
$before = new Y();
|
||||
$before = new TestY();
|
||||
$ser = serialize($before);
|
||||
$after = unserialize($ser);
|
||||
|
||||
var_dump($before, $after);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(y)(2) {
|
||||
--EXPECTF--
|
||||
object(TestY)#%d (2) {
|
||||
["A"]=>
|
||||
array(2) {
|
||||
[1]=>
|
||||
object(x)(1) {
|
||||
object(TestX)#%d (1) {
|
||||
["i"]=>
|
||||
int(1)
|
||||
}
|
||||
[2]=>
|
||||
object(x)(1) {
|
||||
object(TestX)#%d (1) {
|
||||
["i"]=>
|
||||
int(2)
|
||||
}
|
||||
}
|
||||
["B"]=>
|
||||
object(x)(1) {
|
||||
object(TestX)#%d (1) {
|
||||
["i"]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
object(y)(2) {
|
||||
object(TestY)#%d (2) {
|
||||
["A"]=>
|
||||
array(2) {
|
||||
[1]=>
|
||||
&object(x)(1) {
|
||||
&object(TestX)#%d (1) {
|
||||
["i"]=>
|
||||
int(1)
|
||||
}
|
||||
[2]=>
|
||||
object(x)(1) {
|
||||
object(TestX)#%d (1) {
|
||||
["i"]=>
|
||||
int(2)
|
||||
}
|
||||
}
|
||||
["B"]=>
|
||||
&object(x)(1) {
|
||||
&object(TestX)#%d (1) {
|
||||
["i"]=>
|
||||
int(1)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user