@@ -4415,7 +4415,7 @@ static zend_always_inline bool is_persistent_class(const zend_class_entry *ce) {
44154415
44164416ZEND_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 ) /* {{{ */
44174417{
4418- zend_property_info * property_info , * property_info_ptr ;
4418+ zend_property_info * property_info ;
44194419
44204420 if (ZEND_TYPE_IS_SET (type )) {
44214421 ce -> ce_flags |= ZEND_ACC_HAS_TYPE_HINTS ;
@@ -4483,19 +4483,13 @@ ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, z
44834483 goto skip_property_storage ;
44844484 }
44854485 }
4486+ #if ZEND_DEBUG
4487+ zend_property_info * existing_prop = zend_hash_find_ptr (& ce -> properties_info , name );
4488+ ZEND_ASSERT (!existing_prop );
4489+ #endif
44864490 if (access_type & ZEND_ACC_STATIC ) {
4487- if ((property_info_ptr = zend_hash_find_ptr (& ce -> properties_info , name )) != NULL ) {
4488- ZEND_ASSERT (property_info_ptr -> flags & ZEND_ACC_STATIC );
4489- property_info -> offset = property_info_ptr -> offset ;
4490- zval_ptr_dtor (& ce -> default_static_members_table [property_info -> offset ]);
4491- if (property_info_ptr -> doc_comment && property_info_ptr -> ce == ce ) {
4492- zend_string_release (property_info_ptr -> doc_comment );
4493- }
4494- zend_hash_del (& ce -> properties_info , name );
4495- } else {
4496- property_info -> offset = ce -> default_static_members_count ++ ;
4497- ce -> default_static_members_table = perealloc (ce -> default_static_members_table , sizeof (zval ) * ce -> default_static_members_count , ce -> type == ZEND_INTERNAL_CLASS );
4498- }
4491+ property_info -> offset = ce -> default_static_members_count ++ ;
4492+ ce -> default_static_members_table = perealloc (ce -> default_static_members_table , sizeof (zval ) * ce -> default_static_members_count , ce -> type == ZEND_INTERNAL_CLASS );
44994493 ZVAL_COPY_VALUE (& ce -> default_static_members_table [property_info -> offset ], property );
45004494 if (!ZEND_MAP_PTR (ce -> static_members_table )) {
45014495 if (ce -> type == ZEND_INTERNAL_CLASS &&
@@ -4504,31 +4498,17 @@ ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, z
45044498 }
45054499 }
45064500 } else {
4507- zval * property_default_ptr ;
4508- if ((property_info_ptr = zend_hash_find_ptr (& ce -> properties_info , name )) != NULL ) {
4509- ZEND_ASSERT (!(property_info_ptr -> flags & ZEND_ACC_STATIC ));
4510- property_info -> offset = property_info_ptr -> offset ;
4511- zval_ptr_dtor (& ce -> default_properties_table [OBJ_PROP_TO_NUM (property_info -> offset )]);
4512- if (property_info_ptr -> doc_comment && property_info_ptr -> ce == ce ) {
4513- zend_string_release_ex (property_info_ptr -> doc_comment , 1 );
4514- }
4515- zend_hash_del (& ce -> properties_info , name );
4501+ property_info -> offset = OBJ_PROP_TO_OFFSET (ce -> default_properties_count );
4502+ ce -> default_properties_count ++ ;
4503+ ce -> default_properties_table = perealloc (ce -> default_properties_table , sizeof (zval ) * ce -> default_properties_count , ce -> type == ZEND_INTERNAL_CLASS );
45164504
4517- ZEND_ASSERT (ce -> type == ZEND_INTERNAL_CLASS );
4518- ZEND_ASSERT (ce -> properties_info_table != NULL );
4519- ce -> properties_info_table [OBJ_PROP_TO_NUM (property_info -> offset )] = property_info ;
4520- } else {
4521- property_info -> offset = OBJ_PROP_TO_OFFSET (ce -> default_properties_count );
4522- ce -> default_properties_count ++ ;
4523- ce -> default_properties_table = perealloc (ce -> default_properties_table , sizeof (zval ) * ce -> default_properties_count , ce -> type == ZEND_INTERNAL_CLASS );
4524-
4525- /* For user classes this is handled during linking */
4526- if (ce -> type == ZEND_INTERNAL_CLASS ) {
4527- ce -> properties_info_table = perealloc (ce -> properties_info_table , sizeof (zend_property_info * ) * ce -> default_properties_count , 1 );
4528- ce -> properties_info_table [ce -> default_properties_count - 1 ] = property_info ;
4529- }
4505+ /* For user classes this is handled during linking */
4506+ if (ce -> type == ZEND_INTERNAL_CLASS ) {
4507+ ce -> properties_info_table = perealloc (ce -> properties_info_table , sizeof (zend_property_info * ) * ce -> default_properties_count , 1 );
4508+ ce -> properties_info_table [ce -> default_properties_count - 1 ] = property_info ;
45304509 }
4531- property_default_ptr = & ce -> default_properties_table [OBJ_PROP_TO_NUM (property_info -> offset )];
4510+
4511+ zval * property_default_ptr = & ce -> default_properties_table [OBJ_PROP_TO_NUM (property_info -> offset )];
45324512 ZVAL_COPY_VALUE (property_default_ptr , property );
45334513 Z_PROP_FLAG_P (property_default_ptr ) = Z_ISUNDEF_P (property ) ? IS_PROP_UNINIT : 0 ;
45344514 }
0 commit comments