diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-09-26 16:05:24 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-09-27 13:00:07 +0200 |
commit | f2b09969db675adf7fa767378deb894c9bf029e0 (patch) | |
tree | 9c2682f82629213987f129d5475e53eeaa98cbd1 /Zend/zend_ast.c | |
parent | 36eecc107670d4d083b0745544b57915716d13c8 (diff) | |
download | php-git-f2b09969db675adf7fa767378deb894c9bf029e0.tar.gz |
Convert "cannot add element" warning to exception
Diffstat (limited to 'Zend/zend_ast.c')
-rw-r--r-- | Zend/zend_ast.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 51c3583a52..0692993490 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -411,9 +411,9 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr) switch (Z_TYPE_P(offset)) { case IS_UNDEF: if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), expr)) { - zend_error(E_WARNING, + zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied"); - zval_ptr_dtor_nogc(expr); + return FAILURE; } break; case IS_STRING: @@ -458,8 +458,9 @@ static int zend_ast_add_unpacked_element(zval *result, zval *expr) { return FAILURE; } else { if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), val)) { - zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied"); - break; + zend_throw_error(NULL, + "Cannot add element to the array as the next element is already occupied"); + return FAILURE; } Z_TRY_ADDREF_P(val); } |