@@ -756,7 +756,7 @@ static bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg)
756756}
757757
758758#if ZEND_DEBUG
759- static bool can_convert_to_string (zval * zv ) {
759+ static bool can_convert_to_string (const zval * zv ) {
760760 /* We don't call cast_object here, because this check must be side-effect free. As this
761761 * is only used for a sanity check of arginfo/zpp consistency, it's okay if we accept
762762 * more than actually allowed here. */
@@ -768,7 +768,7 @@ static bool can_convert_to_string(zval *zv) {
768768}
769769
770770/* Used to sanity-check internal arginfo types without performing any actual type conversions. */
771- static bool zend_verify_weak_scalar_type_hint_no_sideeffect (uint32_t type_mask , zval * arg )
771+ static bool zend_verify_weak_scalar_type_hint_no_sideeffect (uint32_t type_mask , const zval * arg )
772772{
773773 zend_long lval ;
774774 double dval ;
@@ -813,7 +813,7 @@ ZEND_API bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, bool s
813813 return zend_verify_weak_scalar_type_hint (type_mask , arg );
814814}
815815
816- ZEND_COLD zend_never_inline void zend_verify_property_type_error (zend_property_info * info , zval * property )
816+ ZEND_COLD zend_never_inline void zend_verify_property_type_error (const zend_property_info * info , const zval * property )
817817{
818818 zend_string * type_str ;
819819
@@ -831,7 +831,7 @@ ZEND_COLD zend_never_inline void zend_verify_property_type_error(zend_property_i
831831 zend_string_release (type_str );
832832}
833833
834- ZEND_COLD zend_never_inline void zend_magic_get_property_type_inconsistency_error (zend_property_info * info , zval * property )
834+ ZEND_COLD zend_never_inline void zend_magic_get_property_type_inconsistency_error (const zend_property_info * info , const zval * property )
835835{
836836 /* we _may_ land here in case reading already errored and runtime cache thus has not been updated (i.e. it contains a valid but unrelated info) */
837837 if (EG (exception )) {
@@ -848,7 +848,7 @@ ZEND_COLD zend_never_inline void zend_magic_get_property_type_inconsistency_erro
848848 zend_string_release (type_str );
849849}
850850
851- ZEND_COLD void zend_match_unhandled_error (zval * value )
851+ ZEND_COLD void zend_match_unhandled_error (const zval * value )
852852{
853853 smart_str msg = {0 };
854854
@@ -868,18 +868,18 @@ ZEND_COLD void zend_match_unhandled_error(zval *value)
868868}
869869
870870ZEND_API ZEND_COLD void ZEND_FASTCALL zend_readonly_property_modification_error (
871- zend_property_info * info ) {
871+ const zend_property_info * info ) {
872872 zend_throw_error (NULL , "Cannot modify readonly property %s::$%s" ,
873873 ZSTR_VAL (info -> ce -> name ), zend_get_unmangled_property_name (info -> name ));
874874}
875875
876- ZEND_API ZEND_COLD void ZEND_FASTCALL zend_readonly_property_indirect_modification_error (zend_property_info * info )
876+ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_readonly_property_indirect_modification_error (const zend_property_info * info )
877877{
878878 zend_throw_error (NULL , "Cannot indirectly modify readonly property %s::$%s" ,
879879 ZSTR_VAL (info -> ce -> name ), zend_get_unmangled_property_name (info -> name ));
880880}
881881
882- static zend_class_entry * resolve_single_class_type (zend_string * name , zend_class_entry * self_ce ) {
882+ static const zend_class_entry * resolve_single_class_type (zend_string * name , const zend_class_entry * self_ce ) {
883883 if (zend_string_equals_literal_ci (name , "self" )) {
884884 return self_ce ;
885885 } else if (zend_string_equals_literal_ci (name , "parent" )) {
@@ -889,8 +889,8 @@ static zend_class_entry *resolve_single_class_type(zend_string *name, zend_class
889889 }
890890}
891891
892- static zend_always_inline zend_class_entry * zend_ce_from_type (
893- zend_property_info * info , zend_type * type ) {
892+ static zend_always_inline const zend_class_entry * zend_ce_from_type (
893+ const zend_property_info * info , const zend_type * type ) {
894894 ZEND_ASSERT (ZEND_TYPE_HAS_NAME (* type ));
895895 zend_string * name = ZEND_TYPE_NAME (* type );
896896 if (ZSTR_HAS_CE_CACHE (name )) {
@@ -904,13 +904,13 @@ static zend_always_inline zend_class_entry *zend_ce_from_type(
904904}
905905
906906static bool zend_check_intersection_for_property_class_type (zend_type_list * intersection_type_list ,
907- zend_property_info * info , zend_class_entry * object_ce )
907+ const zend_property_info * info , const zend_class_entry * object_ce )
908908{
909909 zend_type * list_type ;
910910
911911 ZEND_TYPE_LIST_FOREACH (intersection_type_list , list_type ) {
912912 ZEND_ASSERT (!ZEND_TYPE_HAS_LIST (* list_type ));
913- zend_class_entry * ce = zend_ce_from_type (info , list_type );
913+ const zend_class_entry * ce = zend_ce_from_type (info , list_type );
914914 if (!ce || !instanceof_function (object_ce , ce )) {
915915 return false;
916916 }
@@ -919,7 +919,7 @@ static bool zend_check_intersection_for_property_class_type(zend_type_list *inte
919919}
920920
921921static bool zend_check_and_resolve_property_class_type (
922- zend_property_info * info , zend_class_entry * object_ce ) {
922+ const zend_property_info * info , const zend_class_entry * object_ce ) {
923923 if (ZEND_TYPE_HAS_LIST (info -> type )) {
924924 zend_type * list_type ;
925925 if (ZEND_TYPE_IS_INTERSECTION (info -> type )) {
@@ -935,20 +935,20 @@ static bool zend_check_and_resolve_property_class_type(
935935 continue ;
936936 }
937937 ZEND_ASSERT (!ZEND_TYPE_HAS_LIST (* list_type ));
938- zend_class_entry * ce = zend_ce_from_type (info , list_type );
938+ const zend_class_entry * ce = zend_ce_from_type (info , list_type );
939939 if (ce && instanceof_function (object_ce , ce )) {
940940 return true;
941941 }
942942 } ZEND_TYPE_LIST_FOREACH_END ();
943943 return false;
944944 }
945945 } else {
946- zend_class_entry * ce = zend_ce_from_type (info , & info -> type );
946+ const zend_class_entry * ce = zend_ce_from_type (info , & info -> type );
947947 return ce && instanceof_function (object_ce , ce );
948948 }
949949}
950950
951- static zend_always_inline bool i_zend_check_property_type (zend_property_info * info , zval * property , bool strict )
951+ static zend_always_inline bool i_zend_check_property_type (const zend_property_info * info , zval * property , bool strict )
952952{
953953 ZEND_ASSERT (!Z_ISREF_P (property ));
954954 if (EXPECTED (ZEND_TYPE_CONTAINS_CODE (info -> type , Z_TYPE_P (property )))) {
@@ -965,7 +965,7 @@ static zend_always_inline bool i_zend_check_property_type(zend_property_info *in
965965 return zend_verify_scalar_type_hint (type_mask , property , strict , 0 );
966966}
967967
968- static zend_always_inline bool i_zend_verify_property_type (zend_property_info * info , zval * property , bool strict )
968+ static zend_always_inline bool i_zend_verify_property_type (const zend_property_info * info , zval * property , bool strict )
969969{
970970 if (i_zend_check_property_type (info , property , strict )) {
971971 return 1 ;
@@ -975,7 +975,7 @@ static zend_always_inline bool i_zend_verify_property_type(zend_property_info *i
975975 return 0 ;
976976}
977977
978- ZEND_API bool zend_never_inline zend_verify_property_type (zend_property_info * info , zval * property , bool strict ) {
978+ ZEND_API bool zend_never_inline zend_verify_property_type (const zend_property_info * info , zval * property , bool strict ) {
979979 return i_zend_verify_property_type (info , property , strict );
980980}
981981
@@ -3387,7 +3387,7 @@ static zend_always_inline zend_result zend_fetch_static_property_address(zval **
33873387 return SUCCESS ;
33883388}
33893389
3390- ZEND_API ZEND_COLD void zend_throw_ref_type_error_type (zend_property_info * prop1 , zend_property_info * prop2 , zval * zv ) {
3390+ ZEND_API ZEND_COLD void zend_throw_ref_type_error_type (const zend_property_info * prop1 , const zend_property_info * prop2 , const zval * zv ) {
33913391 zend_string * type1_str = zend_type_to_string (prop1 -> type );
33923392 zend_string * type2_str = zend_type_to_string (prop2 -> type );
33933393 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" ,
@@ -3403,7 +3403,7 @@ ZEND_API ZEND_COLD void zend_throw_ref_type_error_type(zend_property_info *prop1
34033403 zend_string_release (type2_str );
34043404}
34053405
3406- ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval (zend_property_info * prop , zval * zv ) {
3406+ ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval (const zend_property_info * prop , const zval * zv ) {
34073407 zend_string * type_str = zend_type_to_string (prop -> type );
34083408 zend_type_error ("Cannot assign %s to reference held by property %s::$%s of type %s" ,
34093409 zend_zval_type_name (zv ),
@@ -3414,7 +3414,7 @@ ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval(zend_property_info *prop,
34143414 zend_string_release (type_str );
34153415}
34163416
3417- ZEND_API ZEND_COLD void zend_throw_conflicting_coercion_error (zend_property_info * prop1 , zend_property_info * prop2 , zval * zv ) {
3417+ ZEND_API ZEND_COLD void zend_throw_conflicting_coercion_error (const zend_property_info * prop1 , const zend_property_info * prop2 , const zval * zv ) {
34183418 zend_string * type1_str = zend_type_to_string (prop1 -> type );
34193419 zend_string * type2_str = zend_type_to_string (prop2 -> type );
34203420 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" ,
@@ -3432,7 +3432,7 @@ ZEND_API ZEND_COLD void zend_throw_conflicting_coercion_error(zend_property_info
34323432
34333433/* 1: valid, 0: invalid, -1: may be valid after type coercion */
34343434static zend_always_inline int i_zend_verify_type_assignable_zval (
3435- zend_property_info * info , zval * zv , bool strict ) {
3435+ const zend_property_info * info , const zval * zv , bool strict ) {
34363436 zend_type type = info -> type ;
34373437 uint32_t type_mask ;
34383438 zend_uchar zv_type = Z_TYPE_P (zv );
@@ -3474,11 +3474,11 @@ static zend_always_inline int i_zend_verify_type_assignable_zval(
34743474
34753475ZEND_API bool ZEND_FASTCALL zend_verify_ref_assignable_zval (zend_reference * ref , zval * zv , bool strict )
34763476{
3477- zend_property_info * prop ;
3477+ const zend_property_info * prop ;
34783478
34793479 /* The value must satisfy each property type, and coerce to the same value for each property
34803480 * type. Remember the first coerced type and value we've seen for this purpose. */
3481- zend_property_info * first_prop = NULL ;
3481+ const zend_property_info * first_prop = NULL ;
34823482 zval coerced_value ;
34833483 ZVAL_UNDEF (& coerced_value );
34843484
@@ -3584,7 +3584,7 @@ ZEND_API zval* zend_assign_to_typed_ref(zval *variable_ptr, zval *orig_value, ze
35843584 return variable_ptr ;
35853585}
35863586
3587- ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref_ex (zend_property_info * prop_info , zval * orig_val , bool strict , zend_verify_prop_assignable_by_ref_context context ) {
3587+ ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref_ex (const zend_property_info * prop_info , zval * orig_val , bool strict , zend_verify_prop_assignable_by_ref_context context ) {
35883588 zval * val = orig_val ;
35893589 if (Z_ISREF_P (val ) && ZEND_REF_HAS_TYPE_SOURCES (Z_REF_P (val ))) {
35903590 int result ;
@@ -3601,7 +3601,7 @@ ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref_ex(zend_property_
36013601 zval tmp ;
36023602 ZVAL_COPY (& tmp , val );
36033603 if (zend_verify_weak_scalar_type_hint (ZEND_TYPE_FULL_MASK (prop_info -> type ), & tmp )) {
3604- zend_property_info * ref_prop = ZEND_REF_FIRST_SOURCE (Z_REF_P (orig_val ));
3604+ const zend_property_info * ref_prop = ZEND_REF_FIRST_SOURCE (Z_REF_P (orig_val ));
36053605 zend_throw_ref_type_error_type (ref_prop , prop_info , val );
36063606 zval_ptr_dtor (& tmp );
36073607 return 0 ;
@@ -3625,7 +3625,7 @@ ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref_ex(zend_property_
36253625 return 0 ;
36263626}
36273627
3628- ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref (zend_property_info * prop_info , zval * orig_val , bool strict ) {
3628+ ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref (const zend_property_info * prop_info , zval * orig_val , bool strict ) {
36293629 return zend_verify_prop_assignable_by_ref_ex (prop_info , orig_val , strict , ZEND_VERIFY_PROP_ASSIGNABLE_BY_REF_CONTEXT_ASSIGNMENT );
36303630}
36313631
@@ -3652,7 +3652,7 @@ ZEND_API void ZEND_FASTCALL zend_ref_add_type_source(zend_property_info_source_l
36523652 source_list -> list = ZEND_PROPERTY_INFO_SOURCE_FROM_LIST (list );
36533653}
36543654
3655- ZEND_API void ZEND_FASTCALL zend_ref_del_type_source (zend_property_info_source_list * source_list , zend_property_info * prop )
3655+ ZEND_API void ZEND_FASTCALL zend_ref_del_type_source (zend_property_info_source_list * source_list , const zend_property_info * prop )
36563656{
36573657 zend_property_info_list * list = ZEND_PROPERTY_INFO_SOURCE_TO_LIST (source_list -> list );
36583658 zend_property_info * * ptr , * * end ;
0 commit comments