tony2001 Tue Oct 2 10:04:38 2007 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/standard array.c
Log:
MF5_2: improved recursion detection in array_walk()
fixes #42752, though the leaks are still there
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.37.2.1&r2=1.308.2.21.2.37.2.2&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.37.2.1
php-src/ext/standard/array.c:1.308.2.21.2.37.2.2
--- php-src/ext/standard/array.c:1.308.2.21.2.37.2.1 Mon Oct 1 12:34:19 2007
+++ php-src/ext/standard/array.c Tue Oct 2 10:04:38 2007
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.308.2.21.2.37.2.1 2007/10/01 12:34:19 jani Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.37.2.2 2007/10/02 10:04:38 tony2001 Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -1079,11 +1079,13 @@
SEPARATE_ZVAL_TO_MAKE_IS_REF(args[0]);
thash = HASH_OF(*(args[0]));
- if (thash == target_hash) {
+ if (thash->nApplyCount > 1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"recursion detected");
return 0;
}
+ thash->nApplyCount++;
php_array_walk(thash, userdata, recursive TSRMLS_CC);
+ thash->nApplyCount--;
} else {
zend_fcall_info fci;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php