Deprecate using null as an array offset and when calling array_key_exists()#19511
Merged
Girgias merged 5 commits intophp:masterfrom Sep 4, 2025
Merged
Deprecate using null as an array offset and when calling array_key_exists()#19511Girgias merged 5 commits intophp:masterfrom
array_key_exists()#19511Girgias merged 5 commits intophp:masterfrom
Conversation
17 tasks
b1629ed to
6b521a3
Compare
TimWolla
reviewed
Aug 19, 2025
472c3c6 to
baeda1f
Compare
DanielEScherzer
requested changes
Aug 20, 2025
baeda1f to
a6d44e0
Compare
d5fd9e5 to
a602268
Compare
Member
Author
|
Still a few tests to fix but we're getting closer |
6f50c89 to
e508fcc
Compare
8f22921 to
dc5049b
Compare
arnaud-lb
reviewed
Aug 21, 2025
c47e2b5 to
58878be
Compare
7c574af to
a1564b1
Compare
736aac0 to
1bf2dbd
Compare
ed3ac5b to
8324606
Compare
8324606 to
95306bb
Compare
650df87 to
eece4cc
Compare
Member
|
@nielsdos @alexandre-daubois is there still something blocking here? |
eece4cc to
3c39e45
Compare
Member
Author
|
Ah yes I missed your comment, PR updated. All good on my side |
Member
|
Circle CI failures look legit |
3c39e45 to
075dd16
Compare
edorian
approved these changes
Sep 3, 2025
Member
edorian
left a comment
There was a problem hiding this comment.
RM approval 👍, no technical review performed
Member
|
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. |
Member
Author
|
Oh right, your last comment in our thread got lost in my notifications, sorry. PR updated and green. Thanks! |
ndossche
approved these changes
Sep 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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