From fa406902d5a4bd3f50d29c3e3cff723e18492c2f Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 28 Oct 2005 09:57:35 +0000 Subject: [PATCH] Fixed bug #34982 (array_walk_recursive() modifies elements outside function scope) --- NEWS | 2 ++ ext/standard/array.c | 1 + 2 files changed, 3 insertions(+) diff --git a/NEWS b/NEWS index f18a22509c..abecaad5fb 100644 --- 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) diff --git a/ext/standard/array.c b/ext/standard/array.c index fd9f2af36f..bbb4e958bd 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -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"); -- 2.50.1