1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

jit: fixed "Uninitialized string offset" warning being emitted at the same time as invalid offset Error

This commit is contained in:
Gina Peter Banyard
2023-11-27 16:04:41 +00:00
parent 6a914cb7a5
commit ed8b901869
3 changed files with 27 additions and 0 deletions

4
NEWS
View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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--
<?php
$container = '';
$dimension = [];
try {
var_dump($container[$dimension]);
} catch (\Throwable $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Cannot access offset of type array on string