Skip to content

Commit d9ecd94

Browse files
committed
Use zend_string for container variable
Also pass called CE
1 parent e8e220e commit d9ecd94

File tree

9 files changed

+54
-52
lines changed

9 files changed

+54
-52
lines changed

Zend/zend.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,7 @@ ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const c
17201720
/* }}} */
17211721

17221722
/* type should be one of the BP_VAR_* constants, only special messages happen for isset/empty and unset */
1723-
ZEND_API ZEND_COLD void zend_illegal_container_offset(const char *container, const zval *offset, int type)
1723+
ZEND_API ZEND_COLD void zend_illegal_container_offset(const zend_string *container, const zval *offset, int type)
17241724
{
17251725
switch (type) {
17261726
case BP_VAR_IS:
@@ -1732,7 +1732,7 @@ ZEND_API ZEND_COLD void zend_illegal_container_offset(const char *container, con
17321732
return;
17331733
default:
17341734
zend_type_error("Cannot access offset of type %s on %s",
1735-
zend_zval_type_name(offset), container);
1735+
zend_zval_type_name(offset), ZSTR_VAL(container));
17361736
return;
17371737
}
17381738
}

Zend/zend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ ZEND_API ZEND_COLD void zend_type_error(const char *format, ...) ZEND_ATTRIBUTE_
358358
ZEND_API ZEND_COLD void zend_argument_count_error(const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2);
359359
ZEND_API ZEND_COLD void zend_value_error(const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2);
360360
/* type should be one of the BP_VAR_* constants, only special messages happen for isset/empty and unset */
361-
ZEND_API ZEND_COLD void zend_illegal_container_offset(const char *container, const zval *offset, int type);
361+
ZEND_API ZEND_COLD void zend_illegal_container_offset(const zend_string *container, const zval *offset, int type);
362362

363363
ZEND_COLD void zenderror(const char *error);
364364

Zend/zend_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2102,7 +2102,7 @@ ZEND_API zend_result array_set_zval_key(HashTable *ht, zval *key, zval *value) /
21022102
result = zend_hash_index_update(ht, zend_dval_to_lval_safe(Z_DVAL_P(key)), value);
21032103
break;
21042104
default:
2105-
zend_illegal_container_offset("array", key, BP_VAR_W);
2105+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), key, BP_VAR_W);
21062106
result = NULL;
21072107
}
21082108

Zend/zend_execute.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,7 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type
16311631
}
16321632
return offset;
16331633
}
1634-
zend_illegal_container_offset("string", dim, type);
1634+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_STRING), dim, type);
16351635
return 0;
16361636
}
16371637
case IS_UNDEF:
@@ -1647,7 +1647,7 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type
16471647
dim = Z_REFVAL_P(dim);
16481648
goto try_again;
16491649
default:
1650-
zend_illegal_container_offset("string", dim, type);
1650+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_STRING), dim, type);
16511651
return 0;
16521652
}
16531653

@@ -2370,7 +2370,7 @@ static zend_never_inline uint8_t slow_index_convert(HashTable *ht, const zval *d
23702370
value->lval = 1;
23712371
return IS_LONG;
23722372
default:
2373-
zend_illegal_container_offset("array", dim, BP_VAR_R);
2373+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), dim, BP_VAR_R);
23742374
return IS_NULL;
23752375
}
23762376
}
@@ -2444,7 +2444,7 @@ static zend_never_inline uint8_t slow_index_convert_w(HashTable *ht, const zval
24442444
value->lval = 1;
24452445
return IS_LONG;
24462446
default:
2447-
zend_illegal_container_offset("array", dim, BP_VAR_W);
2447+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), dim, BP_VAR_W);
24482448
return IS_NULL;
24492449
}
24502450
}
@@ -2742,7 +2742,7 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
27422742
ZVAL_NULL(result);
27432743
return;
27442744
}
2745-
zend_illegal_container_offset("string", dim, BP_VAR_R);
2745+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_STRING), dim, BP_VAR_R);
27462746
ZVAL_NULL(result);
27472747
return;
27482748
}
@@ -2781,7 +2781,7 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
27812781
dim = Z_REFVAL_P(dim);
27822782
goto try_string_offset;
27832783
default:
2784-
zend_illegal_container_offset("string", dim, BP_VAR_R);
2784+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_STRING), dim, BP_VAR_R);
27852785
ZVAL_NULL(result);
27862786
return;
27872787
}
@@ -2903,7 +2903,7 @@ static zend_never_inline zval* ZEND_FASTCALL zend_find_array_dim_slow(HashTable
29032903
ZVAL_UNDEFINED_OP2();
29042904
goto str_idx;
29052905
} else {
2906-
zend_illegal_container_offset("array", offset, BP_VAR_IS);
2906+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), offset, BP_VAR_IS);
29072907
return NULL;
29082908
}
29092909
}
@@ -3026,7 +3026,7 @@ static zend_never_inline bool ZEND_FASTCALL zend_array_key_exists_fast(HashTable
30263026
str = ZSTR_EMPTY_ALLOC();
30273027
goto str_key;
30283028
} else {
3029-
zend_illegal_container_offset("array", key, BP_VAR_R);
3029+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), key, BP_VAR_R);
30303030
return 0;
30313031
}
30323032
}

Zend/zend_vm_def.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6098,7 +6098,7 @@ ZEND_VM_C_LABEL(num_index):
60986098
str = ZSTR_EMPTY_ALLOC();
60996099
ZEND_VM_C_GOTO(str_index);
61006100
} else {
6101-
zend_illegal_container_offset("array", offset, BP_VAR_W);
6101+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), offset, BP_VAR_W);
61026102
zval_ptr_dtor_nogc(expr_ptr);
61036103
}
61046104
FREE_OP2();
@@ -6610,7 +6610,7 @@ ZEND_VM_C_LABEL(num_index_dim):
66106610
key = ZSTR_EMPTY_ALLOC();
66116611
ZEND_VM_C_GOTO(str_index_dim);
66126612
} else {
6613-
zend_illegal_container_offset("array", offset, BP_VAR_UNSET);
6613+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), offset, BP_VAR_UNSET);
66146614
}
66156615
break;
66166616
} else if (Z_ISREF_P(container)) {

Zend/zend_vm_execute.h

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_r_helper(zend_array *ht, zval *dim,
478478
hval = 1;
479479
goto num_index;
480480
default:
481-
zend_illegal_container_offset("array", dim, BP_VAR_R);
481+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), dim, BP_VAR_R);
482482
undef_result_after_exception();
483483
return;
484484
}
@@ -620,7 +620,7 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_is_helper(zend_array *ht, zval *dim
620620
hval = 1;
621621
goto num_index;
622622
default:
623-
zend_illegal_container_offset("array", dim, BP_VAR_IS);
623+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), dim, BP_VAR_IS);
624624
undef_result_after_exception();
625625
return;
626626
}
@@ -722,7 +722,7 @@ static int ZEND_FASTCALL zend_jit_fetch_dim_isset_helper(zend_array *ht, zval *d
722722
hval = 1;
723723
goto num_index;
724724
default:
725-
zend_illegal_container_offset("array", dim, BP_VAR_IS);
725+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), dim, BP_VAR_IS);
726726
return 0;
727727
}
728728

@@ -858,7 +858,7 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_rw_helper(zend_array *ht, zval *di
858858
hval = 1;
859859
goto num_index;
860860
default:
861-
zend_illegal_container_offset("array", dim, BP_VAR_RW);
861+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), dim, BP_VAR_RW);
862862
undef_result_after_exception();
863863
return NULL;
864864
}
@@ -991,7 +991,7 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_w_helper(zend_array *ht, zval *dim
991991
hval = 1;
992992
goto num_index;
993993
default:
994-
zend_illegal_container_offset("array", dim, BP_VAR_R);
994+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), dim, BP_VAR_R);
995995
undef_result_after_exception();
996996
if (EG(opline_before_exception)
997997
&& (EG(opline_before_exception)+1)->opcode == ZEND_OP_DATA
@@ -1035,7 +1035,7 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type)
10351035
}
10361036
return offset;
10371037
}
1038-
zend_illegal_container_offset("string", dim, BP_VAR_R);
1038+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_STRING), dim, BP_VAR_R);
10391039
return 0;
10401040
}
10411041
case IS_UNDEF:
@@ -1051,7 +1051,7 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type)
10511051
dim = Z_REFVAL_P(dim);
10521052
goto try_again;
10531053
default:
1054-
zend_illegal_container_offset("string", dim, type);
1054+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_STRING), dim, type);
10551055
return 0;
10561056
}
10571057

@@ -1126,7 +1126,7 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_str_is_helper(zend_string *str, zva
11261126
dim = Z_REFVAL_P(dim);
11271127
goto try_string_offset;
11281128
default:
1129-
zend_illegal_container_offset("string", dim, BP_VAR_IS);
1129+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_STRING), dim, BP_VAR_IS);
11301130
break;
11311131
}
11321132

0 commit comments

Comments
 (0)