summaryrefslogtreecommitdiff
path: root/ext/standard/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/array.c')
-rw-r--r--ext/standard/array.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 502d15ea3a..f16cc40969 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -1861,7 +1861,7 @@ PHPAPI HashTable* php_splice(HashTable *in_hash, int offset, int length, zval *l
/* ..for each one, create a new zval, copy entry into it and copy it into the output hash */
for (i = 0; i < list_count; i++) {
entry = &list[i];
- Z_ADDREF_P(entry);
+ if (IS_REFCOUNTED(Z_TYPE_P(entry))) Z_ADDREF_P(entry);
zend_hash_next_index_insert(out_hash, entry);
}
}
@@ -1871,7 +1871,7 @@ PHPAPI HashTable* php_splice(HashTable *in_hash, int offset, int length, zval *l
p = in_hash->arData + idx;
if (Z_TYPE(p->val) == IS_UNDEF) continue;
entry = &p->val;
- Z_ADDREF_P(entry);
+ if (IS_REFCOUNTED(Z_TYPE_P(entry))) Z_ADDREF_P(entry);
if (p->key == NULL) {
zend_hash_next_index_insert(out_hash, entry);
} else {