]> granicus.if.org Git - php/commitdiff
MFH:- Fixed bug in handling arrays which caused the original array being modified...
authorJani Taskinen <jani@php.net>
Wed, 6 Feb 2008 19:07:36 +0000 (19:07 +0000)
committerJani Taskinen <jani@php.net>
Wed, 6 Feb 2008 19:07:36 +0000 (19:07 +0000)
ext/filter/filter.c

index bc2cd3a09c1ac265a4bc97eb2558d025a37fc319..c2c097759aea7a99a858c5804d71a91b174b9941 100644 (file)
@@ -453,15 +453,16 @@ static void php_zval_filter_recursive(zval **value, long filter, long flags, zva
 
                for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(value), &pos);
                         zend_hash_get_current_data_ex(Z_ARRVAL_PP(value), (void **) &element, &pos) == SUCCESS;
-                        zend_hash_move_forward_ex(Z_ARRVAL_PP(value), &pos)) {
-
-                               if (Z_TYPE_PP(element) == IS_ARRAY) {
-                                       Z_ARRVAL_PP(element)->nApplyCount++;
-                                       php_zval_filter_recursive(element, filter, flags, options, charset, copy TSRMLS_CC);
-                                       Z_ARRVAL_PP(element)->nApplyCount--;
-                               } else {
-                                       php_zval_filter(element, filter, flags, options, charset, copy TSRMLS_CC);
-                               }
+                        zend_hash_move_forward_ex(Z_ARRVAL_PP(value), &pos)
+               ) {
+                       SEPARATE_ZVAL_IF_NOT_REF(element);
+                       if (Z_TYPE_PP(element) == IS_ARRAY) {
+                               Z_ARRVAL_PP(element)->nApplyCount++;
+                               php_zval_filter_recursive(element, filter, flags, options, charset, copy TSRMLS_CC);
+                               Z_ARRVAL_PP(element)->nApplyCount--;
+                       } else {
+                               php_zval_filter(element, filter, flags, options, charset, copy TSRMLS_CC);
+                       }
                }
        } else {
                php_zval_filter(value, filter, flags, options, charset, copy TSRMLS_CC);