@@ -757,7 +757,7 @@ static bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg)
757
757
}
758
758
759
759
#if ZEND_DEBUG
760
- static bool can_convert_to_string (zval * zv ) {
760
+ static bool can_convert_to_string (const zval * zv ) {
761
761
/* We don't call cast_object here, because this check must be side-effect free. As this
762
762
* is only used for a sanity check of arginfo/zpp consistency, it's okay if we accept
763
763
* more than actually allowed here. */
@@ -769,7 +769,7 @@ static bool can_convert_to_string(zval *zv) {
769
769
}
770
770
771
771
/* Used to sanity-check internal arginfo types without performing any actual type conversions. */
772
- static bool zend_verify_weak_scalar_type_hint_no_sideeffect (uint32_t type_mask , zval * arg )
772
+ static bool zend_verify_weak_scalar_type_hint_no_sideeffect (uint32_t type_mask , const zval * arg )
773
773
{
774
774
zend_long lval ;
775
775
double dval ;
@@ -814,7 +814,7 @@ ZEND_API bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, bool s
814
814
return zend_verify_weak_scalar_type_hint (type_mask , arg );
815
815
}
816
816
817
- ZEND_COLD zend_never_inline void zend_verify_property_type_error (zend_property_info * info , zval * property )
817
+ ZEND_COLD zend_never_inline void zend_verify_property_type_error (const zend_property_info * info , const zval * property )
818
818
{
819
819
zend_string * type_str ;
820
820
@@ -832,7 +832,7 @@ ZEND_COLD zend_never_inline void zend_verify_property_type_error(zend_property_i
832
832
zend_string_release (type_str );
833
833
}
834
834
835
- ZEND_COLD void zend_match_unhandled_error (zval * value )
835
+ ZEND_COLD void zend_match_unhandled_error (const zval * value )
836
836
{
837
837
smart_str msg = {0 };
838
838
@@ -852,18 +852,18 @@ ZEND_COLD void zend_match_unhandled_error(zval *value)
852
852
}
853
853
854
854
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_readonly_property_modification_error (
855
- zend_property_info * info ) {
855
+ const zend_property_info * info ) {
856
856
zend_throw_error (NULL , "Cannot modify readonly property %s::$%s" ,
857
857
ZSTR_VAL (info -> ce -> name ), zend_get_unmangled_property_name (info -> name ));
858
858
}
859
859
860
- ZEND_API ZEND_COLD void ZEND_FASTCALL zend_readonly_property_indirect_modification_error (zend_property_info * info )
860
+ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_readonly_property_indirect_modification_error (const zend_property_info * info )
861
861
{
862
862
zend_throw_error (NULL , "Cannot indirectly modify readonly property %s::$%s" ,
863
863
ZSTR_VAL (info -> ce -> name ), zend_get_unmangled_property_name (info -> name ));
864
864
}
865
865
866
- static zend_class_entry * resolve_single_class_type (zend_string * name , zend_class_entry * self_ce ) {
866
+ static const zend_class_entry * resolve_single_class_type (zend_string * name , const zend_class_entry * self_ce ) {
867
867
if (zend_string_equals_literal_ci (name , "self" )) {
868
868
return self_ce ;
869
869
} else if (zend_string_equals_literal_ci (name , "parent" )) {
@@ -873,8 +873,8 @@ static zend_class_entry *resolve_single_class_type(zend_string *name, zend_class
873
873
}
874
874
}
875
875
876
- static zend_always_inline zend_class_entry * zend_ce_from_type (
877
- zend_property_info * info , zend_type * type ) {
876
+ static zend_always_inline const zend_class_entry * zend_ce_from_type (
877
+ const zend_property_info * info , const zend_type * type ) {
878
878
ZEND_ASSERT (ZEND_TYPE_HAS_NAME (* type ));
879
879
zend_string * name = ZEND_TYPE_NAME (* type );
880
880
if (ZSTR_HAS_CE_CACHE (name )) {
@@ -888,13 +888,13 @@ static zend_always_inline zend_class_entry *zend_ce_from_type(
888
888
}
889
889
890
890
static bool zend_check_intersection_for_property_class_type (zend_type_list * intersection_type_list ,
891
- zend_property_info * info , zend_class_entry * object_ce )
891
+ const zend_property_info * info , const zend_class_entry * object_ce )
892
892
{
893
893
zend_type * list_type ;
894
894
895
895
ZEND_TYPE_LIST_FOREACH (intersection_type_list , list_type ) {
896
896
ZEND_ASSERT (!ZEND_TYPE_HAS_LIST (* list_type ));
897
- zend_class_entry * ce = zend_ce_from_type (info , list_type );
897
+ const zend_class_entry * ce = zend_ce_from_type (info , list_type );
898
898
if (!ce || !instanceof_function (object_ce , ce )) {
899
899
return false;
900
900
}
@@ -903,7 +903,7 @@ static bool zend_check_intersection_for_property_class_type(zend_type_list *inte
903
903
}
904
904
905
905
static bool zend_check_and_resolve_property_class_type (
906
- zend_property_info * info , zend_class_entry * object_ce ) {
906
+ const zend_property_info * info , const zend_class_entry * object_ce ) {
907
907
if (ZEND_TYPE_HAS_LIST (info -> type )) {
908
908
zend_type * list_type ;
909
909
if (ZEND_TYPE_IS_INTERSECTION (info -> type )) {
@@ -919,20 +919,20 @@ static bool zend_check_and_resolve_property_class_type(
919
919
continue ;
920
920
}
921
921
ZEND_ASSERT (!ZEND_TYPE_HAS_LIST (* list_type ));
922
- zend_class_entry * ce = zend_ce_from_type (info , list_type );
922
+ const zend_class_entry * ce = zend_ce_from_type (info , list_type );
923
923
if (ce && instanceof_function (object_ce , ce )) {
924
924
return true;
925
925
}
926
926
} ZEND_TYPE_LIST_FOREACH_END ();
927
927
return false;
928
928
}
929
929
} else {
930
- zend_class_entry * ce = zend_ce_from_type (info , & info -> type );
930
+ const zend_class_entry * ce = zend_ce_from_type (info , & info -> type );
931
931
return ce && instanceof_function (object_ce , ce );
932
932
}
933
933
}
934
934
935
- static zend_always_inline bool i_zend_check_property_type (zend_property_info * info , zval * property , bool strict )
935
+ static zend_always_inline bool i_zend_check_property_type (const zend_property_info * info , zval * property , bool strict )
936
936
{
937
937
ZEND_ASSERT (!Z_ISREF_P (property ));
938
938
if (EXPECTED (ZEND_TYPE_CONTAINS_CODE (info -> type , Z_TYPE_P (property )))) {
@@ -949,7 +949,7 @@ static zend_always_inline bool i_zend_check_property_type(zend_property_info *in
949
949
return zend_verify_scalar_type_hint (type_mask , property , strict , 0 );
950
950
}
951
951
952
- static zend_always_inline bool i_zend_verify_property_type (zend_property_info * info , zval * property , bool strict )
952
+ static zend_always_inline bool i_zend_verify_property_type (const zend_property_info * info , zval * property , bool strict )
953
953
{
954
954
if (i_zend_check_property_type (info , property , strict )) {
955
955
return 1 ;
@@ -959,7 +959,7 @@ static zend_always_inline bool i_zend_verify_property_type(zend_property_info *i
959
959
return 0 ;
960
960
}
961
961
962
- ZEND_API bool zend_never_inline zend_verify_property_type (zend_property_info * info , zval * property , bool strict ) {
962
+ ZEND_API bool zend_never_inline zend_verify_property_type (const zend_property_info * info , zval * property , bool strict ) {
963
963
return i_zend_verify_property_type (info , property , strict );
964
964
}
965
965
@@ -3363,7 +3363,7 @@ static zend_always_inline zend_result zend_fetch_static_property_address(zval **
3363
3363
return SUCCESS ;
3364
3364
}
3365
3365
3366
- ZEND_API ZEND_COLD void zend_throw_ref_type_error_type (zend_property_info * prop1 , zend_property_info * prop2 , zval * zv ) {
3366
+ ZEND_API ZEND_COLD void zend_throw_ref_type_error_type (const zend_property_info * prop1 , const zend_property_info * prop2 , const zval * zv ) {
3367
3367
zend_string * type1_str = zend_type_to_string (prop1 -> type );
3368
3368
zend_string * type2_str = zend_type_to_string (prop2 -> type );
3369
3369
zend_type_error ("Reference with value of type %s held by property %s::$%s of type %s is not compatible with property %s::$%s of type %s" ,
@@ -3379,7 +3379,7 @@ ZEND_API ZEND_COLD void zend_throw_ref_type_error_type(zend_property_info *prop1
3379
3379
zend_string_release (type2_str );
3380
3380
}
3381
3381
3382
- ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval (zend_property_info * prop , zval * zv ) {
3382
+ ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval (const zend_property_info * prop , const zval * zv ) {
3383
3383
zend_string * type_str = zend_type_to_string (prop -> type );
3384
3384
zend_type_error ("Cannot assign %s to reference held by property %s::$%s of type %s" ,
3385
3385
zend_zval_type_name (zv ),
@@ -3390,7 +3390,7 @@ ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval(zend_property_info *prop,
3390
3390
zend_string_release (type_str );
3391
3391
}
3392
3392
3393
- ZEND_API ZEND_COLD void zend_throw_conflicting_coercion_error (zend_property_info * prop1 , zend_property_info * prop2 , zval * zv ) {
3393
+ ZEND_API ZEND_COLD void zend_throw_conflicting_coercion_error (const zend_property_info * prop1 , const zend_property_info * prop2 , const zval * zv ) {
3394
3394
zend_string * type1_str = zend_type_to_string (prop1 -> type );
3395
3395
zend_string * type2_str = zend_type_to_string (prop2 -> type );
3396
3396
zend_type_error ("Cannot assign %s to reference held by property %s::$%s of type %s and property %s::$%s of type %s, as this would result in an inconsistent type conversion" ,
@@ -3408,7 +3408,7 @@ ZEND_API ZEND_COLD void zend_throw_conflicting_coercion_error(zend_property_info
3408
3408
3409
3409
/* 1: valid, 0: invalid, -1: may be valid after type coercion */
3410
3410
static zend_always_inline int i_zend_verify_type_assignable_zval (
3411
- zend_property_info * info , zval * zv , bool strict ) {
3411
+ const zend_property_info * info , const zval * zv , bool strict ) {
3412
3412
zend_type type = info -> type ;
3413
3413
uint32_t type_mask ;
3414
3414
zend_uchar zv_type = Z_TYPE_P (zv );
@@ -3450,11 +3450,11 @@ static zend_always_inline int i_zend_verify_type_assignable_zval(
3450
3450
3451
3451
ZEND_API bool ZEND_FASTCALL zend_verify_ref_assignable_zval (zend_reference * ref , zval * zv , bool strict )
3452
3452
{
3453
- zend_property_info * prop ;
3453
+ const zend_property_info * prop ;
3454
3454
3455
3455
/* The value must satisfy each property type, and coerce to the same value for each property
3456
3456
* type. Remember the first coerced type and value we've seen for this purpose. */
3457
- zend_property_info * first_prop = NULL ;
3457
+ const zend_property_info * first_prop = NULL ;
3458
3458
zval coerced_value ;
3459
3459
ZVAL_UNDEF (& coerced_value );
3460
3460
@@ -3560,7 +3560,7 @@ ZEND_API zval* zend_assign_to_typed_ref(zval *variable_ptr, zval *orig_value, ze
3560
3560
return variable_ptr ;
3561
3561
}
3562
3562
3563
- ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref (zend_property_info * prop_info , zval * orig_val , bool strict ) {
3563
+ ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref (const zend_property_info * prop_info , zval * orig_val , bool strict ) {
3564
3564
zval * val = orig_val ;
3565
3565
if (Z_ISREF_P (val ) && ZEND_REF_HAS_TYPE_SOURCES (Z_REF_P (val ))) {
3566
3566
int result ;
@@ -3577,7 +3577,7 @@ ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref(zend_property_inf
3577
3577
zval tmp ;
3578
3578
ZVAL_COPY (& tmp , val );
3579
3579
if (zend_verify_weak_scalar_type_hint (ZEND_TYPE_FULL_MASK (prop_info -> type ), & tmp )) {
3580
- zend_property_info * ref_prop = ZEND_REF_FIRST_SOURCE (Z_REF_P (orig_val ));
3580
+ const zend_property_info * ref_prop = ZEND_REF_FIRST_SOURCE (Z_REF_P (orig_val ));
3581
3581
zend_throw_ref_type_error_type (ref_prop , prop_info , val );
3582
3582
zval_ptr_dtor (& tmp );
3583
3583
return 0 ;
@@ -3618,7 +3618,7 @@ ZEND_API void ZEND_FASTCALL zend_ref_add_type_source(zend_property_info_source_l
3618
3618
source_list -> list = ZEND_PROPERTY_INFO_SOURCE_FROM_LIST (list );
3619
3619
}
3620
3620
3621
- ZEND_API void ZEND_FASTCALL zend_ref_del_type_source (zend_property_info_source_list * source_list , zend_property_info * prop )
3621
+ ZEND_API void ZEND_FASTCALL zend_ref_del_type_source (zend_property_info_source_list * source_list , const zend_property_info * prop )
3622
3622
{
3623
3623
zend_property_info_list * list = ZEND_PROPERTY_INFO_SOURCE_TO_LIST (source_list -> list );
3624
3624
zend_property_info * * ptr , * * end ;
0 commit comments