summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r--Zend/zend_compile.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 5b67ef8295..d3bec3714e 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5929,7 +5929,7 @@ void zend_do_add_array_element(znode *result, const znode *expr, const znode *of
}
/* }}} */
-void zend_do_add_static_array_element(zval *result, zval *offset, const zval *expr) /* {{{ */
+void zend_do_add_static_array_element(zval *result, zval *offset, zval *expr) /* {{{ */
{
if (offset) {
switch (Z_TYPE_P(offset)) {
@@ -5952,7 +5952,10 @@ void zend_do_add_static_array_element(zval *result, zval *offset, const zval *ex
break;
}
} else {
- zend_hash_next_index_insert(Z_ARRVAL_P(result), &expr, sizeof(zval *), NULL);
+ if (zend_hash_next_index_insert(Z_ARRVAL_P(result), &expr, sizeof(zval *), NULL) == FAILURE) {
+ zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
+ zval_ptr_dtor(&expr);
+ }
}
}
/* }}} */