summaryrefslogtreecommitdiff
path: root/ext/spl/spl_array.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl/spl_array.c')
-rw-r--r--ext/spl/spl_array.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 9ddd38bccf..0740c063e9 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -439,19 +439,16 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
return;
}
+ if (Z_REFCOUNTED_P(value)) {
+ Z_ADDREF_P(value);
+ }
+
if (!offset) {
ht = spl_array_get_hash_table(intern);
- if (Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
- }
zend_hash_next_index_insert(ht, value);
return;
}
- if (Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
- }
-
try_again:
switch (Z_TYPE_P(offset)) {
case IS_STRING:
@@ -485,6 +482,7 @@ num_index:
goto try_again;
default:
zend_error(E_WARNING, "Illegal offset type");
+ zval_ptr_dtor(value);
return;
}
} /* }}} */