Uh oh!
There was an error while loading. Please reload this page.
Deprecate using null as an array offset and when calling array_key_exists() - #19511
Conversation
b1629ed to
6b521a3CompareUh oh!
There was an error while loading. Please reload this page.
472c3c6 to
baeda1fCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
baeda1f to
a6d44e0Compared5fd9e5 to
a602268Comparealexandre-daubois
commented
Aug 20, 2025
Still a few tests to fix but we're getting closer |
6f50c89 to
e508fccCompare8f22921 to
dc5049bCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
c47e2b5 to
58878beCompare736aac0 to
1bf2dbdCompareed3ac5b to
8324606Compare8324606 to
95306bbCompareUh oh!
There was an error while loading. Please reload this page.
650df87 to
eece4ccCompareGirgias
commented
Sep 3, 2025
@nielsdos@alexandre-daubois is there still something blocking here? |
eece4cc to
3c39e45Comparealexandre-daubois
commented
Sep 3, 2025
Ah yes I missed your comment, PR updated. All good on my side |
Girgias
commented
Sep 3, 2025
Circle CI failures look legit |
3c39e45 to
075dd16Compare
edorian
left a comment
There was a problem hiding this comment.
RM approval 👍, no technical review performed
ndossche
commented
Sep 3, 2025
It can still be simplified: diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c
index 261f06068c8..ce48d102234 100644
--- a/ext/opcache/jit/zend_jit_helpers.c+++ b/ext/opcache/jit/zend_jit_helpers.c@@ -501,33 +501,17 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_r_helper(zend_array *ht, zval *dim,
}
ZEND_FALLTHROUGH;
case IS_NULL:
- /* The array may be destroyed while throwing the notice.- * Temporarily increase the refcount to detect this situation. */- if (!(GC_FLAGS(ht) & IS_ARRAY_IMMUTABLE)) {- GC_ADDREF(ht);+ retval = zend_hash_find(ht, ZSTR_EMPTY_ALLOC());+ if (!retval) {+ ZVAL_NULL(result);+ } else {+ ZVAL_COPY_DEREF(result, retval);
}
- execute_data = EG(current_execute_data);- opline = EX(opline);
zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead");
- if (!(GC_FLAGS(ht) & IS_ARRAY_IMMUTABLE) && !GC_DELREF(ht)) {- zend_array_destroy(ht);- if (opline->result_type & (IS_VAR | IS_TMP_VAR)) {- if (EG(exception)) {- ZVAL_UNDEF(EX_VAR(opline->result.var));- } else {- ZVAL_NULL(EX_VAR(opline->result.var));- }- }- return;- }- if (EG(exception)) {- if (opline->result_type & (IS_VAR | IS_TMP_VAR)) {- ZVAL_UNDEF(EX_VAR(opline->result.var));- }- return;+ if (!retval) {+ zend_error(E_WARNING, "Undefined array key \"\"");
}
- offset_key = ZSTR_EMPTY_ALLOC();- goto str_index;+ return;
case IS_DOUBLE:
hval = zend_dval_to_lval(Z_DVAL_P(dim));
if (!zend_is_long_compatible(Z_DVAL_P(dim), hval)) {
the write cases are more annoying but this read case works on my machine. |
Oh right, your last comment in our thread got lost in my notifications, sorry. PR updated and green. Thanks! |
Part of #19468
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_using_values_null_as_an_array_offset_and_when_calling_array_key_exists
cc @Girgias