diff options
author | foobar <sniper@php.net> | 2005-01-18 11:36:44 +0000 |
---|---|---|
committer | foobar <sniper@php.net> | 2005-01-18 11:36:44 +0000 |
commit | 197711bb7d76f3cb3f5e850c3b1022ba1c84d370 (patch) | |
tree | 4b5f9baba0c03b8f30d6913e57f2880093552c60 | |
parent | bed68d88288fd463de3829dc5732cf74b7fb91dd (diff) | |
download | php-git-197711bb7d76f3cb3f5e850c3b1022ba1c84d370.tar.gz |
Add test for bug #31402
-rw-r--r-- | ext/standard/tests/serialize/bug31402.phpt | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/ext/standard/tests/serialize/bug31402.phpt b/ext/standard/tests/serialize/bug31402.phpt new file mode 100644 index 0000000000..4f8bf0ca5b --- /dev/null +++ b/ext/standard/tests/serialize/bug31402.phpt @@ -0,0 +1,72 @@ +--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) + } +} |