Merge branch 'PHP-8.2' into PHP-8.3

* PHP-8.2:
  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:05:22 +00:00
commit 52463ae233
No known key found for this signature in database
GPG Key ID: 3306078E3194AEBD
3 changed files with 27 additions and 0 deletions

4
NEWS
View File

@ -11,6 +11,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)
- Standard
. Fixed GH-12745 (http_build_query() default null argument for $arg_separator
is implicitly coerced to string). (Girgias)

View File

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

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