-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deprecate using null as an array offset and when calling array_key_exists()
#19511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Deprecate using null as an array offset and when calling array_key_exists()
#19511
Conversation
b1629ed
to
6b521a3
Compare
472c3c6
to
baeda1f
Compare
baeda1f
to
a6d44e0
Compare
d5fd9e5
to
a602268
Compare
Still a few tests to fix but we're getting closer |
6f50c89
to
e508fcc
Compare
8f22921
to
dc5049b
Compare
c47e2b5
to
58878be
Compare
7c574af
to
a1564b1
Compare
736aac0
to
1bf2dbd
Compare
ed3ac5b
to
8324606
Compare
8324606
to
95306bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This is okay on my side, but I would like for @nielsdos to confirm that whatever the issue was is now resolved. :)
650df87
to
eece4cc
Compare
@nielsdos @alexandre-daubois is there still something blocking here? |
eece4cc
to
3c39e45
Compare
Ah yes I missed your comment, PR updated. All good on my side |
Circle CI failures look legit |
3c39e45
to
075dd16
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RM approval 👍, no technical review performed
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