com php-src: Fixed reference counting: Zend/zend_builtin_fu nctions.c
| From: | Dmitry Stogov | Date: | Wed, 16 Apr 2014 08:33:25 +0000 |
| Subject: | com php-src: Fixed reference counting: Zend/zend_builtin_fu nctions.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77376@lists.php.net to get a copy of this message | ||
Commit: 2f65090a38c07d351d8bfef2a8167086067c8a21
Author: Dmitry Stogov <dmitry@zend.com> Wed, 16 Apr 2014 12:33:25 +0400
Parents: fb4e0a63643e03f23e4a1a24892b93635566184a
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2f65090a38c07d351d8bfef2a8167086067c8a21
Log:
Fixed reference counting
Changed paths:
M Zend/zend_builtin_functions.c
Diff:
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index f86b704..aebcb74 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -610,11 +610,13 @@ ZEND_FUNCTION(each)
if (Z_ISREF_P(entry)) {
ZVAL_DUP(&tmp, Z_REFVAL_P(entry));
entry = &tmp;
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ } else {
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
}
zend_hash_index_update(Z_ARRVAL_P(return_value), 1, entry);
- if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
zend_hash_str_update(Z_ARRVAL_P(return_value), "value", sizeof("value")-1,
entry);
- if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
/* add the key elements */
switch (zend_hash_get_current_key(target_hash, &key, &num_key, 0)) {