From: Arnaud Le Blanc Date: Sun, 23 Nov 2008 20:36:32 +0000 (+0000) Subject: MFH: Fixed bug #46649 (Setting array element with that same array produces X-Git-Tag: php-5.2.7RC5~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d6b86e9d4d847274785eb46e4a159a58318b3633;p=php MFH: Fixed bug #46649 (Setting array element with that same array produces inconsistent results) --- diff --git a/NEWS b/NEWS index 7c4043f954..b06261481a 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Nov 2008, PHP 5.2.7 - Fixed memory leak inside readline_callback_handler_remove() function. (Felipe) +- Fixed bug #46649 (Setting array element with that same array produces + inconsistent results). (Arnaud) - Fixed bug #46643 (Upgraded PCRE to 7.8) 20 Nov 2008, PHP 5.2.7RC4 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 22a7135e21..e0c25c2d44 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -565,6 +565,7 @@ void zend_do_assign(znode *result, znode *variable, 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; } }