@@ -500,33 +500,17 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_r_helper(zend_array *ht, zval *dim,
500500 }
501501 ZEND_FALLTHROUGH ;
502502 case IS_NULL :
503- /* The array may be destroyed while throwing the notice.
504- * Temporarily increase the refcount to detect this situation. */
505- if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE )) {
506- GC_ADDREF (ht );
503+ offset_key = ZSTR_EMPTY_ALLOC ();
504+ retval = zend_hash_find (ht , offset_key );
505+ if (!retval ) {
506+ zend_error (E_WARNING , "Undefined array key \"\"" );
507+ ZVAL_NULL (result );
508+ } else {
509+ ZVAL_COPY_DEREF (result , retval );
507510 }
508- execute_data = EG (current_execute_data );
509- opline = EX (opline );
510511 zend_error (E_DEPRECATED , "Using null as an array offset is deprecated, use an empty string instead" );
511- if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE ) && !GC_DELREF (ht )) {
512- zend_array_destroy (ht );
513- if (opline -> result_type & (IS_VAR | IS_TMP_VAR )) {
514- if (EG (exception )) {
515- ZVAL_UNDEF (EX_VAR (opline -> result .var ));
516- } else {
517- ZVAL_NULL (EX_VAR (opline -> result .var ));
518- }
519- }
520- return ;
521- }
522- if (EG (exception )) {
523- if (opline -> result_type & (IS_VAR | IS_TMP_VAR )) {
524- ZVAL_UNDEF (EX_VAR (opline -> result .var ));
525- }
526- return ;
527- }
528- offset_key = ZSTR_EMPTY_ALLOC ();
529- goto str_index ;
512+
513+ return ;
530514 case IS_DOUBLE :
531515 hval = zend_dval_to_lval (Z_DVAL_P (dim ));
532516 if (!zend_is_long_compatible (Z_DVAL_P (dim ), hval )) {
@@ -669,9 +653,8 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_is_helper(zend_array *ht, zval *dim
669653 case IS_NULL :
670654 /* The array may be destroyed while throwing the notice.
671655 * Temporarily increase the refcount to detect this situation. */
672- if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE )) {
673- GC_ADDREF (ht );
674- }
656+ GC_TRY_ADDREF (ht );
657+
675658 execute_data = EG (current_execute_data );
676659 opline = EX (opline );
677660 zend_error (E_DEPRECATED , "Using null as an array offset is deprecated, use an empty string instead" );
@@ -822,9 +805,8 @@ static int ZEND_FASTCALL zend_jit_fetch_dim_isset_helper(zend_array *ht, zval *d
822805 case IS_NULL :
823806 /* The array may be destroyed while throwing the notice.
824807 * Temporarily increase the refcount to detect this situation. */
825- if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE )) {
826- GC_ADDREF (ht );
827- }
808+ GC_TRY_ADDREF (ht );
809+
828810 zend_error (E_DEPRECATED , "Using null as an array offset is deprecated, use an empty string instead" );
829811 if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE ) && !GC_DELREF (ht )) {
830812 zend_array_destroy (ht );
@@ -943,9 +925,8 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_rw_helper(zend_array *ht, zval *di
943925 case IS_NULL :
944926 /* The array may be destroyed while throwing the notice.
945927 * Temporarily increase the refcount to detect this situation. */
946- if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE )) {
947- GC_ADDREF (ht );
948- }
928+ GC_TRY_ADDREF (ht );
929+
949930 execute_data = EG (current_execute_data );
950931 opline = EX (opline );
951932 zend_error (E_DEPRECATED , "Using null as an array offset is deprecated, use an empty string instead" );
@@ -1083,31 +1064,30 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_w_helper(zend_array *ht, zval *dim
10831064 offset_key = Z_STR_P (dim );
10841065 goto str_index ;
10851066 case IS_UNDEF :
1067+ case IS_NULL :
10861068 execute_data = EG (current_execute_data );
10871069 opline = EX (opline );
1088- if (!zend_jit_undefined_op_helper_write (ht , opline -> op2 .var )) {
1089- if (opline -> result_type & (IS_VAR | IS_TMP_VAR )) {
1090- if (EG (exception )) {
1091- ZVAL_UNDEF (EX_VAR (opline -> result .var ));
1092- } else {
1093- ZVAL_NULL (EX_VAR (opline -> result .var ));
1070+ if (Z_TYPE_P (dim ) == IS_UNDEF ) {
1071+ if (!zend_jit_undefined_op_helper_write (ht , opline -> op2 .var )) {
1072+ if (opline -> result_type & (IS_VAR | IS_TMP_VAR )) {
1073+ if (EG (exception )) {
1074+ ZVAL_UNDEF (EX_VAR (opline -> result .var ));
1075+ } else {
1076+ ZVAL_NULL (EX_VAR (opline -> result .var ));
1077+ }
10941078 }
1079+ if (opline -> opcode == ZEND_ASSIGN_DIM
1080+ && ((opline + 1 )-> op1_type & (IS_VAR | IS_TMP_VAR ))) {
1081+ zval_ptr_dtor_nogc (EX_VAR ((opline + 1 )-> op1 .var ));
1082+ }
1083+ return NULL ;
10951084 }
1096- if (opline -> opcode == ZEND_ASSIGN_DIM
1097- && ((opline + 1 )-> op1_type & (IS_VAR | IS_TMP_VAR ))) {
1098- zval_ptr_dtor_nogc (EX_VAR ((opline + 1 )-> op1 .var ));
1099- }
1100- return NULL ;
11011085 }
1102- ZEND_FALLTHROUGH ;
1103- case IS_NULL :
1086+
11041087 /* The array may be destroyed while throwing the notice.
11051088 * Temporarily increase the refcount to detect this situation. */
1106- if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE )) {
1107- GC_ADDREF (ht );
1108- }
1109- execute_data = EG (current_execute_data );
1110- opline = EX (opline );
1089+ GC_TRY_ADDREF (ht );
1090+
11111091 zend_error (E_DEPRECATED , "Using null as an array offset is deprecated, use an empty string instead" );
11121092 if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE ) && GC_DELREF (ht ) != 1 ) {
11131093 if (!GC_REFCOUNT (ht )) {
0 commit comments