summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend_builtin_functions.c6
-rw-r--r--Zend/zend_execute_API.c1
2 files changed, 4 insertions, 3 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index f86b70465d..aebcb7436c 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)) {
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 2db5fd397c..a72fb5dd6d 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -522,7 +522,6 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope
actual_len -= (actual - Z_STRVAL_P(p));
if (inline_change) {
zend_string *s = STR_INIT(actual, actual_len, 0);
- STR_RELEASE(Z_STR_P(p));
Z_STR_P(p) = s;
Z_TYPE_FLAGS_P(p) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
}