Skip to content

Commit f957335

Browse files
authored
Move static property check to assert (#12239)
Staticness incompatiblity must error before attempting to declare the property.
1 parent 55432bf commit f957335

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Zend/zend_API.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4328,8 +4328,8 @@ ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, z
43284328
access_type |= ZEND_ACC_PUBLIC;
43294329
}
43304330
if (access_type & ZEND_ACC_STATIC) {
4331-
if ((property_info_ptr = zend_hash_find_ptr(&ce->properties_info, name)) != NULL &&
4332-
(property_info_ptr->flags & ZEND_ACC_STATIC) != 0) {
4331+
if ((property_info_ptr = zend_hash_find_ptr(&ce->properties_info, name)) != NULL) {
4332+
ZEND_ASSERT(property_info_ptr->flags & ZEND_ACC_STATIC);
43334333
property_info->offset = property_info_ptr->offset;
43344334
zval_ptr_dtor(&ce->default_static_members_table[property_info->offset]);
43354335
if (property_info_ptr->doc_comment) {
@@ -4349,8 +4349,8 @@ ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, z
43494349
}
43504350
} else {
43514351
zval *property_default_ptr;
4352-
if ((property_info_ptr = zend_hash_find_ptr(&ce->properties_info, name)) != NULL &&
4353-
(property_info_ptr->flags & ZEND_ACC_STATIC) == 0) {
4352+
if ((property_info_ptr = zend_hash_find_ptr(&ce->properties_info, name)) != NULL) {
4353+
ZEND_ASSERT(!(property_info_ptr->flags & ZEND_ACC_STATIC));
43544354
property_info->offset = property_info_ptr->offset;
43554355
zval_ptr_dtor(&ce->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)]);
43564356
if (property_info_ptr->doc_comment) {

0 commit comments

Comments
 (0)