diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index 563a9b5db50..5f435e328e0 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -1100,6 +1100,9 @@ static zend_string* ZEND_FASTCALL zend_jit_fetch_dim_str_r_helper(zend_string *s } else { offset = Z_LVAL_P(dim); } + if (UNEXPECTED(EG(exception) != NULL)) { + return ZSTR_EMPTY_ALLOC(); + } return zend_jit_fetch_dim_str_offset(str, offset); } diff --git a/ext/opcache/tests/jit/gh12723-A.phpt b/ext/opcache/tests/jit/gh12723-A.phpt new file mode 100644 index 00000000000..f30453e8c0a --- /dev/null +++ b/ext/opcache/tests/jit/gh12723-A.phpt @@ -0,0 +1,20 @@ +--TEST-- +GH-12723: Function JIT emits "Uninitialized string offset" warning at the same time as invalid offset Error +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +--FILE-- +getMessage(), "\n"; +} + +?> +--EXPECT-- +Cannot access offset of type array on string