]> granicus.if.org Git - php/commitdiff
Fixed bug #34982 (array_walk_recursive() modifies elements outside function scope)
authorDmitry Stogov <dmitry@php.net>
Fri, 28 Oct 2005 09:57:35 +0000 (09:57 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 28 Oct 2005 09:57:35 +0000 (09:57 +0000)
NEWS
ext/standard/array.c

diff --git a/NEWS b/NEWS
index f18a22509c614fd2675a20be8b5dfb9dc620e27d..abecaad5fb9bdceb7042509bef71044bf7554703 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ PHP                                                                        NEWS
 - Fixed fgetcsv() and fputcsv() inconsistency. (Dmitry)
 - Fixed bug #34996 (ImageTrueColorToPalette() crashes when ncolors is 
   zero). (Tony)
+- Fixed bug #34982 (array_walk_recursive() modifies elements outside function
+  scope). (Dmitry)
 - Fixed bug #34977 (Compile failure on MacOSX due to use of varargs.h). (Tony)
 - Fixed bug #34968 (bz2 extension fails on to build on some win32 setups).
   (Ilia)
index fd9f2af36facbadce2e06daf9377f5afd615e725..bbb4e958bd8dcbadd888cc9e48455bfdc2724529 100644 (file)
@@ -1072,6 +1072,7 @@ static int php_array_walk(HashTable *target_hash, zval **userdata, int recursive
                if (recursive && Z_TYPE_PP(args[0]) == IS_ARRAY) {
                        HashTable *thash;
                        
+                       SEPARATE_ZVAL_TO_MAKE_IS_REF(args[0]);
                        thash = HASH_OF(*(args[0]));
                        if (thash == target_hash) {
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");