From: Arnaud Le Blanc Date: Sun, 23 Nov 2008 20:35:16 +0000 (+0000) Subject: MFH: Fixed bug #46649 (Setting array element with that same array produces X-Git-Tag: php-5.3.0alpha2~90 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a23d168531fef70fe6a0fd1e90772b57f6a1a014;p=php MFH: Fixed bug #46649 (Setting array element with that same array produces inconsistent results) --- diff --git a/Zend/tests/bug38469.phpt b/Zend/tests/bug38469.phpt index db507df357..6afcaf5fd3 100644 --- a/Zend/tests/bug38469.phpt +++ b/Zend/tests/bug38469.phpt @@ -8,6 +8,16 @@ var_dump($a); $b = array(array()); $b[0][0] = $b; var_dump($b); + +function f() { + $a = array(); + $a[0] = $a; + var_dump($a); + $b = array(array()); + $b[0][0] = $b; + var_dump($b); +} +f(); ?> --EXPECT-- array(1) { @@ -26,3 +36,19 @@ array(1) { } } } +array(1) { + [0]=> + array(0) { + } +} +array(1) { + [0]=> + array(1) { + [0]=> + array(1) { + [0]=> + array(0) { + } + } + } +} diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 358fc81552..c79e288f02 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -583,6 +583,7 @@ void zend_do_assign(znode *result, znode *variable, const znode *value TSRMLS_DC CG(active_op_array)->vars[value->u.var].name, CG(active_op_array)->vars[value->u.var].name_len, 1); SET_UNUSED(opline->op2); + opline->op2.u.EA.type = ZEND_FETCH_LOCAL; value = &opline->result; } }