@@ -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+ retval = zend_hash_find (ht , ZSTR_EMPTY_ALLOC ());
504+ if (!retval ) {
505+ zend_error (E_WARNING , "Undefined array key \"\"" );
506+ ZVAL_NULL (result );
507+ } else {
508+ ZVAL_COPY_DEREF (result , retval );
507509 }
508- execute_data = EG (current_execute_data );
509- opline = EX (opline );
510+
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 );
@@ -833,6 +815,7 @@ static int ZEND_FASTCALL zend_jit_fetch_dim_isset_helper(zend_array *ht, zval *d
833815 if (EG (exception )) {
834816 return 0 ;
835817 }
818+
836819 offset_key = ZSTR_EMPTY_ALLOC ();
837820 goto str_index ;
838821 case IS_DOUBLE :
@@ -924,30 +907,29 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_rw_helper(zend_array *ht, zval *di
924907 offset_key = Z_STR_P (dim );
925908 goto str_index ;
926909 case IS_UNDEF :
910+ case IS_NULL :
927911 execute_data = EG (current_execute_data );
928912 opline = EX (opline );
929- if (UNEXPECTED (opline -> opcode == ZEND_HANDLE_EXCEPTION )) {
930- opline = EG (opline_before_exception );
931- }
932- if (opline && !zend_jit_undefined_op_helper_write (ht , opline -> op2 .var )) {
933- if (opline -> result_type & (IS_VAR | IS_TMP_VAR )) {
934- if (EG (exception )) {
935- ZVAL_UNDEF (EX_VAR (opline -> result .var ));
936- } else {
937- ZVAL_NULL (EX_VAR (opline -> result .var ));
913+ if (Z_TYPE_P (dim ) == IS_UNDEF ) {
914+ if (UNEXPECTED (opline -> opcode == ZEND_HANDLE_EXCEPTION )) {
915+ opline = EG (opline_before_exception );
916+ }
917+ if (opline && !zend_jit_undefined_op_helper_write (ht , opline -> op2 .var )) {
918+ if (opline -> result_type & (IS_VAR | IS_TMP_VAR )) {
919+ if (EG (exception )) {
920+ ZVAL_UNDEF (EX_VAR (opline -> result .var ));
921+ } else {
922+ ZVAL_NULL (EX_VAR (opline -> result .var ));
923+ }
938924 }
925+ return NULL ;
939926 }
940- return NULL ;
941927 }
942- ZEND_FALLTHROUGH ;
943- case IS_NULL :
928+
944929 /* The array may be destroyed while throwing the notice.
945930 * Temporarily increase the refcount to detect this situation. */
946- if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE )) {
947- GC_ADDREF (ht );
948- }
949- execute_data = EG (current_execute_data );
950- opline = EX (opline );
931+ GC_TRY_ADDREF (ht );
932+
951933 zend_error (E_DEPRECATED , "Using null as an array offset is deprecated, use an empty string instead" );
952934 if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE ) && GC_DELREF (ht ) != 1 ) {
953935 if (!GC_REFCOUNT (ht )) {
@@ -1083,31 +1065,30 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_w_helper(zend_array *ht, zval *dim
10831065 offset_key = Z_STR_P (dim );
10841066 goto str_index ;
10851067 case IS_UNDEF :
1068+ case IS_NULL :
10861069 execute_data = EG (current_execute_data );
10871070 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 ));
1071+ if (Z_TYPE_P (dim ) == IS_UNDEF ) {
1072+ if (!zend_jit_undefined_op_helper_write (ht , opline -> op2 .var )) {
1073+ if (opline -> result_type & (IS_VAR | IS_TMP_VAR )) {
1074+ if (EG (exception )) {
1075+ ZVAL_UNDEF (EX_VAR (opline -> result .var ));
1076+ } else {
1077+ ZVAL_NULL (EX_VAR (opline -> result .var ));
1078+ }
10941079 }
1080+ if (opline -> opcode == ZEND_ASSIGN_DIM
1081+ && ((opline + 1 )-> op1_type & (IS_VAR | IS_TMP_VAR ))) {
1082+ zval_ptr_dtor_nogc (EX_VAR ((opline + 1 )-> op1 .var ));
1083+ }
1084+ return NULL ;
10951085 }
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 ;
11011086 }
1102- ZEND_FALLTHROUGH ;
1103- case IS_NULL :
1087+
11041088 /* The array may be destroyed while throwing the notice.
11051089 * 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 );
1090+ GC_TRY_ADDREF (ht );
1091+
11111092 zend_error (E_DEPRECATED , "Using null as an array offset is deprecated, use an empty string instead" );
11121093 if (!(GC_FLAGS (ht ) & IS_ARRAY_IMMUTABLE ) && GC_DELREF (ht ) != 1 ) {
11131094 if (!GC_REFCOUNT (ht )) {
0 commit comments