From: Arnaud Le Blanc Date: Sun, 23 Nov 2008 20:34:40 +0000 (+0000) Subject: Fixed bug #46649 (Setting array element with that same array produces X-Git-Tag: BEFORE_HEAD_NS_CHANGES_MERGE~102 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9e3d2e3655e08ad6bb281c9a5e73bb0c0fbd7205;p=php 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 da547211b5..ca3695f9bf 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -635,6 +635,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; } }