diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index 33c7b6c70a1..48621c011a2 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -581,6 +581,7 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_rw_helper(zend_array *ht, zval *di goto str_index; case IS_UNDEF: if (!zend_jit_undefined_op_helper_write(ht, EG(current_execute_data)->opline->op2.var)) { + undef_result_after_exception(); return NULL; } ZEND_FALLTHROUGH; @@ -644,6 +645,7 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_w_helper(zend_array *ht, zval *dim goto str_index; case IS_UNDEF: if (!zend_jit_undefined_op_helper_write(ht, EG(current_execute_data)->opline->op2.var)) { + undef_result_after_exception(); return NULL; } ZEND_FALLTHROUGH; diff --git a/ext/opcache/tests/jit/assign_dim_undef_exception.phpt b/ext/opcache/tests/jit/assign_dim_undef_exception.phpt new file mode 100644 index 00000000000..00bb22a3a9a --- /dev/null +++ b/ext/opcache/tests/jit/assign_dim_undef_exception.phpt @@ -0,0 +1,38 @@ +--TEST-- +Undef to exception for assign dim offset +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +opcache.jit_buffer_size=1M +--FILE-- +getMessage(), "\n"; +} +try { + test2(); +} catch (Exception $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECT-- +Undefined variable $undef +Undefined variable $undef