com php-src: Fixed support for references: ext/standard/array.c

From: Date: Thu, 13 Mar 2014 19:23:20 +0000
Subject: com php-src: Fixed support for references: ext/standard/array.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-77642@lists.php.net to get a copy of this message
Commit: dd1bd544084d5a5fcfdb804c6ad0237fcfb0a611 Author: Dmitry Stogov <dmitry@zend.com> Thu, 13 Mar 2014 23:23:20 +0400 Parents: 493d5adab5266075bda1b2e09f05de928fd690c6 Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dd1bd544084d5a5fcfdb804c6ad0237fcfb0a611 Log: Fixed support for references Changed paths: M ext/standard/array.c Diff: diff --git a/ext/standard/array.c b/ext/standard/array.c index fb594fb..936a3fa 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1054,13 +1054,19 @@ static int php_array_walk(HashTable *target_hash, zval *userdata, int recursive zend_hash_internal_pointer_reset(target_hash); while (!EG(exception) && (zv = zend_hash_get_current_data(target_hash)) != NULL) { ZVAL_COPY(&args[0], zv); - if (recursive && Z_TYPE(args[0]) == IS_ARRAY) { + if (recursive && + (Z_TYPE(args[0]) == IS_ARRAY || + (Z_ISREF(args[0]) && Z_TYPE_P(Z_REFVAL(args[0])) == IS_ARRAY))) { HashTable *thash; zend_fcall_info orig_array_walk_fci; zend_fcall_info_cache orig_array_walk_fci_cache; - SEPARATE_ZVAL_IF_NOT_REF(&args[0]); - thash = Z_ARRVAL(args[0]); + if (Z_ISREF(args[0])) { + thash = Z_ARRVAL_P(Z_REFVAL(args[0])); + } else { + SEPARATE_ZVAL(&args[0]); + thash = Z_ARRVAL(args[0]); + } if (thash->nApplyCount > 1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); zval_ptr_dtor(&args[0]);

« previous php.cvs (#77642) next »