tony2001                Tue Oct  2 10:04:13 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/standard       array.c 
  Log:
  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&r2=1.308.2.21.2.38&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.37 
php-src/ext/standard/array.c:1.308.2.21.2.38
--- php-src/ext/standard/array.c:1.308.2.21.2.37        Sat Sep 22 15:38:00 2007
+++ php-src/ext/standard/array.c        Tue Oct  2 10:04:13 2007
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.37 2007/09/22 15:38:00 iliaa Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.38 2007/10/02 10:04:13 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

Reply via email to