com php-src: Fixed COUNT_RECURSIVE reference handling: ext/standard/array.c
| From: | Dmitry Stogov | Date: | Mon, 17 Mar 2014 14:04:54 +0000 |
| Subject: | com php-src: Fixed COUNT_RECURSIVE reference handling: ext/standard/array.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77609@lists.php.net to get a copy of this message | ||
Commit: 3203c65c7cb34df29eccd0e520efe1886946217c
Author: Xinchen Hui <laruence@gmail.com> Mon, 17 Mar 2014 22:04:54 +0800
Parents: 77f4c9411445343192d93bdca60b0e82ec0126a5
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3203c65c7cb34df29eccd0e520efe1886946217c
Log:
Fixed COUNT_RECURSIVE reference handling
Changed paths:
M ext/standard/array.c
Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index cbcfecc..ce0fcad 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -288,6 +288,9 @@ static int php_count_recursive(zval *array, long mode TSRMLS_DC) /* {{{ */
zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos)
) {
Z_ARRVAL_P(array)->nApplyCount++;
+ if (Z_TYPE_P(element) == IS_REFERENCE) {
+ element = Z_REFVAL_P(element);
+ }
cnt += php_count_recursive(element, COUNT_RECURSIVE TSRMLS_CC);
Z_ARRVAL_P(array)->nApplyCount--;
}