Skip to content

Commit 2d9a47c

Browse files
committed
Bump zend_property_info.flags size
1 parent aced7a5 commit 2d9a47c

File tree

7 files changed

+29
-26
lines changed

7 files changed

+29
-26
lines changed

Zend/zend_API.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4388,7 +4388,7 @@ static zend_always_inline bool is_persistent_class(zend_class_entry *ce) {
43884388
&& ce->info.internal.module->type == MODULE_PERSISTENT;
43894389
}
43904390

4391-
ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment, zend_type type) /* {{{ */
4391+
ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, zend_string *name, zval *property, zend_prop_flags access_type, zend_string *doc_comment, zend_type type) /* {{{ */
43924392
{
43934393
zend_property_info *property_info, *property_info_ptr;
43944394

@@ -4634,21 +4634,21 @@ ZEND_API zend_result zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval
46344634
}
46354635
/* }}} */
46364636

4637-
ZEND_API void zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment) /* {{{ */
4637+
ZEND_API void zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, zend_prop_flags access_type, zend_string *doc_comment) /* {{{ */
46384638
{
46394639
zend_declare_typed_property(ce, name, property, access_type, doc_comment, (zend_type) ZEND_TYPE_INIT_NONE(0));
46404640
}
46414641
/* }}} */
46424642

4643-
ZEND_API void zend_declare_property(zend_class_entry *ce, const char *name, size_t name_length, zval *property, int access_type) /* {{{ */
4643+
ZEND_API void zend_declare_property(zend_class_entry *ce, const char *name, size_t name_length, zval *property, zend_prop_flags access_type) /* {{{ */
46444644
{
46454645
zend_string *key = zend_string_init(name, name_length, is_persistent_class(ce));
46464646
zend_declare_property_ex(ce, key, property, access_type, NULL);
46474647
zend_string_release(key);
46484648
}
46494649
/* }}} */
46504650

4651-
ZEND_API void zend_declare_property_null(zend_class_entry *ce, const char *name, size_t name_length, int access_type) /* {{{ */
4651+
ZEND_API void zend_declare_property_null(zend_class_entry *ce, const char *name, size_t name_length, zend_prop_flags access_type) /* {{{ */
46524652
{
46534653
zval property;
46544654

@@ -4657,7 +4657,7 @@ ZEND_API void zend_declare_property_null(zend_class_entry *ce, const char *name,
46574657
}
46584658
/* }}} */
46594659

4660-
ZEND_API void zend_declare_property_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type) /* {{{ */
4660+
ZEND_API void zend_declare_property_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, zend_prop_flags access_type) /* {{{ */
46614661
{
46624662
zval property;
46634663

@@ -4666,7 +4666,7 @@ ZEND_API void zend_declare_property_bool(zend_class_entry *ce, const char *name,
46664666
}
46674667
/* }}} */
46684668

4669-
ZEND_API void zend_declare_property_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type) /* {{{ */
4669+
ZEND_API void zend_declare_property_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, zend_prop_flags access_type) /* {{{ */
46704670
{
46714671
zval property;
46724672

@@ -4675,7 +4675,7 @@ ZEND_API void zend_declare_property_long(zend_class_entry *ce, const char *name,
46754675
}
46764676
/* }}} */
46774677

4678-
ZEND_API void zend_declare_property_double(zend_class_entry *ce, const char *name, size_t name_length, double value, int access_type) /* {{{ */
4678+
ZEND_API void zend_declare_property_double(zend_class_entry *ce, const char *name, size_t name_length, double value, zend_prop_flags access_type) /* {{{ */
46794679
{
46804680
zval property;
46814681

@@ -4684,7 +4684,7 @@ ZEND_API void zend_declare_property_double(zend_class_entry *ce, const char *nam
46844684
}
46854685
/* }}} */
46864686

4687-
ZEND_API void zend_declare_property_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value, int access_type) /* {{{ */
4687+
ZEND_API void zend_declare_property_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value, zend_prop_flags access_type) /* {{{ */
46884688
{
46894689
zval property;
46904690

@@ -4693,7 +4693,7 @@ ZEND_API void zend_declare_property_string(zend_class_entry *ce, const char *nam
46934693
}
46944694
/* }}} */
46954695

4696-
ZEND_API void zend_declare_property_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_len, int access_type) /* {{{ */
4696+
ZEND_API void zend_declare_property_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_len, zend_prop_flags access_type) /* {{{ */
46974697
{
46984698
zval property;
46994699

Zend/zend_API.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -422,16 +422,16 @@ ZEND_API bool zend_make_callable(zval *callable, zend_string **callable_name);
422422
ZEND_API const char *zend_get_module_version(const char *module_name);
423423
ZEND_API zend_result zend_get_module_started(const char *module_name);
424424

425-
ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment, zend_type type);
426-
427-
ZEND_API void zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment);
428-
ZEND_API void zend_declare_property(zend_class_entry *ce, const char *name, size_t name_length, zval *property, int access_type);
429-
ZEND_API void zend_declare_property_null(zend_class_entry *ce, const char *name, size_t name_length, int access_type);
430-
ZEND_API void zend_declare_property_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type);
431-
ZEND_API void zend_declare_property_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, int access_type);
432-
ZEND_API void zend_declare_property_double(zend_class_entry *ce, const char *name, size_t name_length, double value, int access_type);
433-
ZEND_API void zend_declare_property_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value, int access_type);
434-
ZEND_API void zend_declare_property_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_len, int access_type);
425+
ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, zend_string *name, zval *property, zend_prop_flags access_type, zend_string *doc_comment, zend_type type);
426+
427+
ZEND_API void zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, zend_prop_flags access_type, zend_string *doc_comment);
428+
ZEND_API void zend_declare_property(zend_class_entry *ce, const char *name, size_t name_length, zval *property, zend_prop_flags access_type);
429+
ZEND_API void zend_declare_property_null(zend_class_entry *ce, const char *name, size_t name_length, zend_prop_flags access_type);
430+
ZEND_API void zend_declare_property_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, zend_prop_flags access_type);
431+
ZEND_API void zend_declare_property_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value, zend_prop_flags access_type);
432+
ZEND_API void zend_declare_property_double(zend_class_entry *ce, const char *name, size_t name_length, double value, zend_prop_flags access_type);
433+
ZEND_API void zend_declare_property_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value, zend_prop_flags access_type);
434+
ZEND_API void zend_declare_property_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_len, zend_prop_flags access_type);
435435

436436
ZEND_API zend_class_constant *zend_declare_typed_class_constant(zend_class_entry *ce, zend_string *name, zval *value, int access_type, zend_string *doc_comment, zend_type type);
437437
ZEND_API zend_class_constant *zend_declare_class_constant_ex(zend_class_entry *ce, zend_string *name, zval *value, int access_type, zend_string *doc_comment);

Zend/zend_compile.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,12 @@ typedef uint64_t zend_fn_flags;
398398

399399
char *zend_visibility_string(zend_fn_flags fn_flags);
400400

401+
typedef uint64_t zend_prop_flags;
402+
401403
typedef struct _zend_property_info {
402404
uint32_t offset; /* property offset for object properties or
403405
property index for static properties */
404-
uint32_t flags;
406+
zend_prop_flags flags;
405407
zend_string *name;
406408
zend_string *doc_comment;
407409
HashTable *attributes;

Zend/zend_inheritance.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2483,7 +2483,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce, zend_class_ent
24832483
continue;
24842484
}
24852485
ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(&traits[i]->properties_info, prop_name, property_info) {
2486-
uint32_t flags = property_info->flags;
2486+
zend_prop_flags flags = property_info->flags;
24872487

24882488
/* next: check for conflicts with current class */
24892489
if ((colliding_prop = zend_hash_find_ptr(&ce->properties_info, prop_name)) != NULL) {
@@ -2492,7 +2492,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce, zend_class_ent
24922492
flags |= ZEND_ACC_CHANGED;
24932493
} else {
24942494
bool is_compatible = false;
2495-
uint32_t flags_mask = ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC | ZEND_ACC_READONLY;
2495+
zend_prop_flags flags_mask = ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC | ZEND_ACC_READONLY;
24962496

24972497
if ((colliding_prop->flags & flags_mask) == (flags & flags_mask) &&
24982498
property_types_compatible(property_info, colliding_prop) == INHERITANCE_SUCCESS

Zend/zend_object_handlers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ static zend_always_inline uintptr_t zend_get_property_offset(zend_class_entry *c
316316
{
317317
zval *zv;
318318
zend_property_info *property_info;
319-
uint32_t flags;
319+
zend_prop_flags flags;
320320
zend_class_entry *scope;
321321
uintptr_t offset;
322322

ext/opcache/jit/zend_jit_ir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13769,8 +13769,8 @@ static int zend_jit_fetch_obj(zend_jit_ctx *jit,
1376913769
ir_IF_TRUE_cold(if_has_prop_info);
1377013770

1377113771
ir_ref if_readonly = ir_IF(
13772-
ir_AND_U32(ir_LOAD_U32(ir_ADD_OFFSET(prop_info_ref, offsetof(zend_property_info, flags))),
13773-
ir_CONST_U32(ZEND_ACC_READONLY)));
13772+
ir_AND_U64(ir_LOAD_U64(ir_ADD_OFFSET(prop_info_ref, offsetof(zend_property_info, flags))),
13773+
ir_CONST_U64(ZEND_ACC_READONLY)));
1377413774
ir_IF_TRUE(if_readonly);
1377513775

1377613776
ir_ref if_prop_obj = jit_if_Z_TYPE(jit, prop_addr, IS_OBJECT);

ext/reflection/php_reflection.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4666,7 +4666,7 @@ ZEND_METHOD(ReflectionClass, getProperty)
46664666
/* }}} */
46674667

46684668
/* {{{ _addproperty */
4669-
static void _addproperty(zend_property_info *pptr, zend_string *key, zend_class_entry *ce, HashTable *ht, long filter)
4669+
static void _addproperty(zend_property_info *pptr, zend_string *key, zend_class_entry *ce, HashTable *ht, zend_long filter)
46704670
{
46714671
if ((pptr->flags & ZEND_ACC_PRIVATE) && pptr->ce != ce) {
46724672
return;
@@ -4712,6 +4712,7 @@ ZEND_METHOD(ReflectionClass, getProperties)
47124712
zend_long filter;
47134713
bool filter_is_null = 1;
47144714

4715+
// FIXME: sizeof(zend_long) < sizeof(zend_prop_flags) on some platforms...
47154716
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &filter, &filter_is_null) == FAILURE) {
47164717
RETURN_THROWS();
47174718
}

0 commit comments

Comments
 (0)