@@ -96,7 +96,7 @@ static void zend_type_copy_ctor(zend_type *const type, bool use_arena, bool pers
96
96
}
97
97
}
98
98
99
- static zend_function * zend_duplicate_internal_function (zend_function * func , const zend_class_entry * ce ) /* {{{ */
99
+ static zend_function * zend_duplicate_internal_function (const zend_function * func , const zend_class_entry * ce ) /* {{{ */
100
100
{
101
101
zend_function * new_function ;
102
102
@@ -310,7 +310,7 @@ static zend_class_entry *lookup_class(zend_class_entry *scope, zend_string *name
310
310
}
311
311
312
312
/* Instanceof that's safe to use on unlinked classes. */
313
- static bool unlinked_instanceof (zend_class_entry * ce1 , const zend_class_entry * ce2 ) {
313
+ static bool unlinked_instanceof (const zend_class_entry * ce1 , const zend_class_entry * ce2 ) {
314
314
if (ce1 == ce2 ) {
315
315
return 1 ;
316
316
}
@@ -347,7 +347,7 @@ static bool unlinked_instanceof(zend_class_entry *ce1, const zend_class_entry *c
347
347
}
348
348
} else {
349
349
for (i = 0 ; i < ce1 -> num_interfaces ; i ++ ) {
350
- zend_class_entry * ce = zend_lookup_class_ex (
350
+ const zend_class_entry * ce = zend_lookup_class_ex (
351
351
ce1 -> interface_names [i ].name , ce1 -> interface_names [i ].lc_name ,
352
352
ZEND_FETCH_CLASS_ALLOW_UNLINKED | ZEND_FETCH_CLASS_NO_AUTOLOAD );
353
353
/* Avoid recursing if class implements itself. */
@@ -362,7 +362,7 @@ static bool unlinked_instanceof(zend_class_entry *ce1, const zend_class_entry *c
362
362
}
363
363
364
364
static bool zend_type_permits_self (
365
- zend_type type , zend_class_entry * scope , zend_class_entry * self ) {
365
+ zend_type type , const zend_class_entry * scope , zend_class_entry * self ) {
366
366
if (ZEND_TYPE_FULL_MASK (type ) & MAY_BE_OBJECT ) {
367
367
return 1 ;
368
368
}
@@ -374,7 +374,7 @@ static bool zend_type_permits_self(
374
374
ZEND_TYPE_FOREACH (type , single_type ) {
375
375
if (ZEND_TYPE_HAS_NAME (* single_type )) {
376
376
zend_string * name = resolve_class_name (scope , ZEND_TYPE_NAME (* single_type ));
377
- zend_class_entry * ce = lookup_class (self , name );
377
+ const zend_class_entry * ce = lookup_class (self , name );
378
378
if (ce && unlinked_instanceof (self , ce )) {
379
379
return 1 ;
380
380
}
@@ -584,7 +584,7 @@ static inheritance_status zend_is_class_subtype_of_type(
584
584
return is_intersection ? INHERITANCE_SUCCESS : INHERITANCE_ERROR ;
585
585
}
586
586
587
- static zend_string * get_class_from_type (zend_class_entry * scope , zend_type single_type ) {
587
+ static zend_string * get_class_from_type (const zend_class_entry * scope , zend_type single_type ) {
588
588
if (ZEND_TYPE_HAS_NAME (single_type )) {
589
589
return resolve_class_name (scope , ZEND_TYPE_NAME (single_type ));
590
590
}
@@ -973,7 +973,7 @@ static ZEND_COLD zend_string *zend_get_function_declaration(
973
973
{
974
974
uint32_t idx = i ;
975
975
zend_op * op = fptr -> op_array .opcodes ;
976
- zend_op * end = op + fptr -> op_array .last ;
976
+ const zend_op * end = op + fptr -> op_array .last ;
977
977
978
978
++ idx ;
979
979
while (op < end ) {
@@ -1366,7 +1366,7 @@ static inheritance_status verify_property_type_compatibility(
1366
1366
return INHERITANCE_SUCCESS ;
1367
1367
}
1368
1368
1369
- static bool property_has_operation (zend_property_info * prop_info , zend_property_hook_kind kind )
1369
+ static bool property_has_operation (const zend_property_info * prop_info , zend_property_hook_kind kind )
1370
1370
{
1371
1371
return (!(prop_info -> flags & ZEND_ACC_VIRTUAL )
1372
1372
&& (kind == ZEND_PROPERTY_HOOK_GET || !(prop_info -> flags & ZEND_ACC_READONLY )))
@@ -1649,7 +1649,7 @@ static inheritance_status class_constant_types_compatible(const zend_class_const
1649
1649
}
1650
1650
1651
1651
static bool do_inherit_constant_check (
1652
- zend_class_entry * ce , zend_class_constant * parent_constant , zend_string * name );
1652
+ zend_class_entry * ce , const zend_class_constant * parent_constant , zend_string * name );
1653
1653
1654
1654
static void do_inherit_class_constant (zend_string * name , zend_class_constant * parent_const , zend_class_entry * ce ) /* {{{ */
1655
1655
{
@@ -1722,7 +1722,7 @@ void zend_build_properties_info_table(zend_class_entry *ce)
1722
1722
} ZEND_HASH_FOREACH_END ();
1723
1723
}
1724
1724
1725
- ZEND_API void zend_verify_hooked_property (zend_class_entry * ce , zend_property_info * prop_info , zend_string * prop_name )
1725
+ ZEND_API void zend_verify_hooked_property (const zend_class_entry * ce , zend_property_info * prop_info , zend_string * prop_name )
1726
1726
{
1727
1727
if (!prop_info -> hooks ) {
1728
1728
return ;
@@ -1746,7 +1746,7 @@ ZEND_API void zend_verify_hooked_property(zend_class_entry *ce, zend_property_in
1746
1746
ZVAL_NULL (& ce -> default_properties_table [OBJ_PROP_TO_NUM (prop_info -> offset )]);
1747
1747
}
1748
1748
for (uint32_t i = 0 ; i < ZEND_PROPERTY_HOOK_COUNT ; i ++ ) {
1749
- zend_function * func = prop_info -> hooks [i ];
1749
+ const zend_function * func = prop_info -> hooks [i ];
1750
1750
if (func ) {
1751
1751
if ((zend_property_hook_kind )i == ZEND_PROPERTY_HOOK_GET
1752
1752
&& (func -> op_array .fn_flags & ZEND_ACC_RETURN_REFERENCE )
@@ -2077,7 +2077,7 @@ static zend_always_inline bool check_trait_property_or_constant_value_compatibil
2077
2077
2078
2078
/** @return bool Returns true if the class constant should be inherited, i.e. whether it doesn't already exist. */
2079
2079
static bool do_inherit_constant_check (
2080
- zend_class_entry * ce , zend_class_constant * parent_constant , zend_string * name
2080
+ zend_class_entry * ce , const zend_class_constant * parent_constant , zend_string * name
2081
2081
) {
2082
2082
zval * zv = zend_hash_find_known_hash (& ce -> constants_table , name );
2083
2083
if (zv == NULL ) {
@@ -2124,7 +2124,7 @@ static bool do_inherit_constant_check(
2124
2124
}
2125
2125
/* }}} */
2126
2126
2127
- static void do_inherit_iface_constant (zend_string * name , zend_class_constant * c , zend_class_entry * ce , zend_class_entry * iface ) /* {{{ */
2127
+ static void do_inherit_iface_constant (zend_string * name , zend_class_constant * c , zend_class_entry * ce , const zend_class_entry * iface ) /* {{{ */
2128
2128
{
2129
2129
if (do_inherit_constant_check (ce , c , name )) {
2130
2130
zend_class_constant * ct ;
@@ -2301,7 +2301,7 @@ static void zend_do_implement_interfaces(zend_class_entry *ce, zend_class_entry
2301
2301
/* }}} */
2302
2302
2303
2303
2304
- void zend_inheritance_check_override (zend_class_entry * ce )
2304
+ void zend_inheritance_check_override (const zend_class_entry * ce )
2305
2305
{
2306
2306
zend_function * f ;
2307
2307
@@ -2423,7 +2423,7 @@ static void zend_fixup_trait_method(zend_function *fn, zend_class_entry *ce) /*
2423
2423
}
2424
2424
/* }}} */
2425
2425
2426
- static void zend_traits_check_private_final_inheritance (uint32_t original_fn_flags , zend_function * fn_copy , zend_string * name )
2426
+ static void zend_traits_check_private_final_inheritance (uint32_t original_fn_flags , const zend_function * fn_copy , const zend_string * name )
2427
2427
{
2428
2428
/* If the function was originally already private+final, then it will have
2429
2429
* already been warned about. Only emit this error when the used trait method
@@ -2506,7 +2506,7 @@ static void zend_traits_copy_functions(zend_string *fnname, zend_function *fn, z
2506
2506
}
2507
2507
/* }}} */
2508
2508
2509
- static uint32_t zend_check_trait_usage (zend_class_entry * ce , zend_class_entry * trait , zend_class_entry * * traits ) /* {{{ */
2509
+ static uint32_t zend_check_trait_usage (const zend_class_entry * ce , const zend_class_entry * trait , zend_class_entry * * traits ) /* {{{ */
2510
2510
{
2511
2511
if (UNEXPECTED ((trait -> ce_flags & ZEND_ACC_TRAIT ) != ZEND_ACC_TRAIT )) {
2512
2512
zend_error_noreturn (E_COMPILE_ERROR , "Class %s is not a trait, Only traits may be used in 'as' and 'insteadof' statements" , ZSTR_VAL (trait -> name ));
@@ -2612,7 +2612,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce, zend_class_e
2612
2612
aliases = ecalloc (i , sizeof (zend_class_entry * ));
2613
2613
i = 0 ;
2614
2614
while (ce -> trait_aliases [i ]) {
2615
- zend_trait_alias * cur_alias = ce -> trait_aliases [i ];
2615
+ const zend_trait_alias * cur_alias = ce -> trait_aliases [i ];
2616
2616
cur_method_ref = & ce -> trait_aliases [i ]-> trait_method ;
2617
2617
lcname = zend_string_tolower (cur_method_ref -> method_name );
2618
2618
if (cur_method_ref -> class_name ) {
@@ -3206,7 +3206,7 @@ static void add_property_hook_obligation(
3206
3206
3207
3207
static void resolve_delayed_variance_obligations (zend_class_entry * ce );
3208
3208
3209
- static void check_variance_obligation (variance_obligation * obligation ) {
3209
+ static void check_variance_obligation (const variance_obligation * obligation ) {
3210
3210
if (obligation -> type == OBLIGATION_DEPENDENCY ) {
3211
3211
zend_class_entry * dependency_ce = obligation -> dependency_ce ;
3212
3212
if (dependency_ce -> ce_flags & ZEND_ACC_UNRESOLVED_VARIANCE ) {
@@ -3245,7 +3245,7 @@ static void check_variance_obligation(variance_obligation *obligation) {
3245
3245
}
3246
3246
}
3247
3247
3248
- static void load_delayed_classes (zend_class_entry * ce ) {
3248
+ static void load_delayed_classes (const zend_class_entry * ce ) {
3249
3249
HashTable * delayed_autoloads = CG (delayed_autoloads );
3250
3250
if (!delayed_autoloads ) {
3251
3251
return ;
@@ -3274,11 +3274,11 @@ static void load_delayed_classes(zend_class_entry *ce) {
3274
3274
}
3275
3275
3276
3276
static void resolve_delayed_variance_obligations (zend_class_entry * ce ) {
3277
- HashTable * all_obligations = CG (delayed_variance_obligations ), * obligations ;
3277
+ HashTable * all_obligations = CG (delayed_variance_obligations );
3278
3278
zend_ulong num_key = (zend_ulong ) (uintptr_t ) ce ;
3279
3279
3280
3280
ZEND_ASSERT (all_obligations != NULL );
3281
- obligations = zend_hash_index_find_ptr (all_obligations , num_key );
3281
+ const HashTable * obligations = zend_hash_index_find_ptr (all_obligations , num_key );
3282
3282
ZEND_ASSERT (obligations != NULL );
3283
3283
3284
3284
variance_obligation * obligation ;
@@ -3312,7 +3312,7 @@ static void check_unrecoverable_load_failure(const zend_class_entry *ce) {
3312
3312
} while (0)
3313
3313
3314
3314
static zend_op_array * zend_lazy_method_load (
3315
- zend_op_array * op_array , zend_class_entry * ce , const zend_class_entry * pce ) {
3315
+ const zend_op_array * op_array , zend_class_entry * ce , const zend_class_entry * pce ) {
3316
3316
ZEND_ASSERT (op_array -> type == ZEND_USER_FUNCTION );
3317
3317
ZEND_ASSERT (op_array -> scope == pce );
3318
3318
ZEND_ASSERT (op_array -> prototype == NULL );
@@ -3326,7 +3326,7 @@ static zend_op_array *zend_lazy_method_load(
3326
3326
return new_op_array ;
3327
3327
}
3328
3328
3329
- static zend_class_entry * zend_lazy_class_load (zend_class_entry * pce )
3329
+ static zend_class_entry * zend_lazy_class_load (const zend_class_entry * pce )
3330
3330
{
3331
3331
zend_class_entry * ce = zend_arena_alloc (& CG (arena ), sizeof (zend_class_entry ));
3332
3332
@@ -3344,7 +3344,7 @@ static zend_class_entry *zend_lazy_class_load(zend_class_entry *pce)
3344
3344
if (ce -> default_properties_table ) {
3345
3345
zval * dst = emalloc (sizeof (zval ) * ce -> default_properties_count );
3346
3346
zval * src = ce -> default_properties_table ;
3347
- zval * end = src + ce -> default_properties_count ;
3347
+ const zval * end = src + ce -> default_properties_count ;
3348
3348
3349
3349
ce -> default_properties_table = dst ;
3350
3350
for (; src != end ; src ++ , dst ++ ) {
@@ -3384,7 +3384,7 @@ static zend_class_entry *zend_lazy_class_load(zend_class_entry *pce)
3384
3384
if (ce -> default_static_members_table ) {
3385
3385
zval * dst = emalloc (sizeof (zval ) * ce -> default_static_members_count );
3386
3386
zval * src = ce -> default_static_members_table ;
3387
- zval * end = src + ce -> default_static_members_count ;
3387
+ const zval * end = src + ce -> default_static_members_count ;
3388
3388
3389
3389
ce -> default_static_members_table = dst ;
3390
3390
for (; src != end ; src ++ , dst ++ ) {
@@ -3401,9 +3401,9 @@ static zend_class_entry *zend_lazy_class_load(zend_class_entry *pce)
3401
3401
p = ce -> properties_info .arData ;
3402
3402
const Bucket * end = p + ce -> properties_info .nNumUsed ;
3403
3403
for (; p != end ; p ++ ) {
3404
- zend_property_info * prop_info , * new_prop_info ;
3404
+ zend_property_info * new_prop_info ;
3405
3405
3406
- prop_info = Z_PTR (p -> val );
3406
+ const zend_property_info * prop_info = Z_PTR (p -> val );
3407
3407
ZEND_ASSERT (prop_info -> ce == pce );
3408
3408
ZEND_ASSERT (prop_info -> prototype == prop_info );
3409
3409
new_prop_info = zend_arena_alloc (& CG (arena ), sizeof (zend_property_info ));
@@ -3437,9 +3437,9 @@ static zend_class_entry *zend_lazy_class_load(zend_class_entry *pce)
3437
3437
p = ce -> constants_table .arData ;
3438
3438
const Bucket * end = p + ce -> constants_table .nNumUsed ;
3439
3439
for (; p != end ; p ++ ) {
3440
- zend_class_constant * c , * new_c ;
3440
+ zend_class_constant * new_c ;
3441
3441
3442
- c = Z_PTR (p -> val );
3442
+ const zend_class_constant * c = Z_PTR (p -> val );
3443
3443
ZEND_ASSERT (c -> ce == pce );
3444
3444
new_c = zend_arena_alloc (& CG (arena ), sizeof (zend_class_constant ));
3445
3445
Z_PTR (p -> val ) = new_c ;
@@ -3464,7 +3464,7 @@ static zend_class_entry *zend_lazy_class_load(zend_class_entry *pce)
3464
3464
} while (0)
3465
3465
#endif
3466
3466
3467
- ZEND_API zend_class_entry * zend_do_link_class (zend_class_entry * ce , zend_string * lc_parent_name , zend_string * key ) /* {{{ */
3467
+ ZEND_API zend_class_entry * zend_do_link_class (zend_class_entry * ce , zend_string * lc_parent_name , const zend_string * key ) /* {{{ */
3468
3468
{
3469
3469
/* Load parent/interface dependencies first, so we can still gracefully abort linking
3470
3470
* with an exception and remove the class from the class table. This is only possible
@@ -3767,7 +3767,7 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string
3767
3767
/* }}} */
3768
3768
3769
3769
/* Check whether early binding is prevented due to unresolved types in inheritance checks. */
3770
- static inheritance_status zend_can_early_bind (zend_class_entry * ce , zend_class_entry * parent_ce ) /* {{{ */
3770
+ static inheritance_status zend_can_early_bind (zend_class_entry * ce , const zend_class_entry * parent_ce ) /* {{{ */
3771
3771
{
3772
3772
zend_string * key ;
3773
3773
zend_function * parent_func ;
0 commit comments