From: SVN Migration Date: Tue, 18 Jan 2005 11:36:45 +0000 (+0000) Subject: This commit was manufactured by cvs2svn to create branch 'PHP_4_3'. X-Git-Tag: php-4.3.11RC1~146 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=db10c7e0f12026f214eae406af45ec2b866b81db;p=php This commit was manufactured by cvs2svn to create branch 'PHP_4_3'. --- 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-- +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) + } +}