diff --git a/NEWS b/NEWS index 1a8f3412b3a..2bc78b317ab 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,10 @@ PHP NEWS . Fixed bug GH-12791 (Possible dereference of NULL in MySQLnd debug code). (nielsdos) +- Opcache: + . Fixed JIT bug (Function JIT emits "Uninitialized string offset" warning + at the same time as invalid offset Error). (Girgias) + - OpenSSL: . Fixed bug #50713 (openssl_pkcs7_verify() may ignore untrusted CAs). (Jakub Zelenka) diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index 95ff48dd4f9..a838a735823 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -1106,6 +1106,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