Skip to content

Commit 4a6e607

Browse files
Core: fix missing deprecation when accessing null array key with JIT (#20883)
1 parent 2b89919 commit 4a6e607

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ PHP NEWS
77
. Fixed bug GH-21059 (Segfault when preloading constant AST closure). (ilutov)
88
. Fixed bug GH-21072 (Crash on (unset) cast in constant expression).
99
(arshidkv12)
10+
. Fix deprecation now showing when accessing null key of an array with JIT.
11+
(alexandre-daubois)
1012

1113
- Windows:
1214
. Fixed compilation with clang (missing intrin.h include). (Kévin Dunglas)

Zend/Optimizer/sccp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,7 @@ static inline zend_result zval_to_string_offset(zend_long *result, zval *op) {
363363
static inline zend_result fetch_array_elem(zval **result, zval *op1, zval *op2) {
364364
switch (Z_TYPE_P(op2)) {
365365
case IS_NULL:
366-
*result = zend_hash_find(Z_ARR_P(op1), ZSTR_EMPTY_ALLOC());
367-
return SUCCESS;
366+
return FAILURE;
368367
case IS_FALSE:
369368
*result = zend_hash_index_find(Z_ARR_P(op1), 0);
370369
return SUCCESS;

ext/opcache/tests/jit/fetch_dim_r_001.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ function foo() {
3030
}
3131
foo();
3232
?>
33-
--EXPECT--
33+
--EXPECTF--
3434
int(1)
3535
int(3)
3636
int(2)
3737
int(1)
3838
int(3)
3939
int(1)
4040
int(2)
41+
42+
Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
4143
int(4)
4244
int(5)
4345
int(5)

0 commit comments

Comments
 (0)