Commit 4a6e6077ef1 for php.net
commit 4a6e6077ef1ba1cd2b94c0f4af7e342393043538
Author: Alexandre Daubois <2144837+alexandre-daubois@users.noreply.github.com>
Date: Fri Jan 30 16:18:33 2026 +0100
Core: fix missing deprecation when accessing null array key with JIT (#20883)
diff --git a/NEWS b/NEWS
index 07c66ec833e..c6bedf8ed11 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ PHP NEWS
. Fixed bug GH-21059 (Segfault when preloading constant AST closure). (ilutov)
. Fixed bug GH-21072 (Crash on (unset) cast in constant expression).
(arshidkv12)
+ . Fix deprecation now showing when accessing null key of an array with JIT.
+ (alexandre-daubois)
- Windows:
. Fixed compilation with clang (missing intrin.h include). (Kévin Dunglas)
diff --git a/Zend/Optimizer/sccp.c b/Zend/Optimizer/sccp.c
index 7e2fc2db1b2..87d7507d4f9 100644
--- a/Zend/Optimizer/sccp.c
+++ b/Zend/Optimizer/sccp.c
@@ -363,8 +363,7 @@ static inline zend_result zval_to_string_offset(zend_long *result, zval *op) {
static inline zend_result fetch_array_elem(zval **result, zval *op1, zval *op2) {
switch (Z_TYPE_P(op2)) {
case IS_NULL:
- *result = zend_hash_find(Z_ARR_P(op1), ZSTR_EMPTY_ALLOC());
- return SUCCESS;
+ return FAILURE;
case IS_FALSE:
*result = zend_hash_index_find(Z_ARR_P(op1), 0);
return SUCCESS;
diff --git a/ext/opcache/tests/jit/fetch_dim_r_001.phpt b/ext/opcache/tests/jit/fetch_dim_r_001.phpt
index 3ff56263db6..819ec7edca6 100644
--- a/ext/opcache/tests/jit/fetch_dim_r_001.phpt
+++ b/ext/opcache/tests/jit/fetch_dim_r_001.phpt
@@ -30,7 +30,7 @@ function foo() {
}
foo();
?>
---EXPECT--
+--EXPECTF--
int(1)
int(3)
int(2)
@@ -38,6 +38,8 @@ function foo() {
int(3)
int(1)
int(2)
+
+Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
int(4)
int(5)
int(5)