@@ -1621,7 +1621,7 @@ static bool do_inherit_constant_check(
1621
1621
}
1622
1622
/* }}} */
1623
1623
1624
- static void do_inherit_interface_constant (zend_string * name , zend_class_constant * c , zend_class_entry * ce , zend_class_entry * iface ) /* {{{ */
1624
+ static void do_inherit_iface_constant (zend_string * name , zend_class_constant * c , zend_class_entry * ce , zend_class_entry * iface ) /* {{{ */
1625
1625
{
1626
1626
if (do_inherit_constant_check (ce , c , name )) {
1627
1627
zend_class_constant * ct ;
@@ -1653,7 +1653,7 @@ static void do_interface_implementation(zend_class_entry *ce, zend_class_entry *
1653
1653
zend_class_constant * c ;
1654
1654
1655
1655
ZEND_HASH_MAP_FOREACH_STR_KEY_PTR (& iface -> constants_table , key , c ) {
1656
- do_inherit_interface_constant (key , c , ce , iface );
1656
+ do_inherit_iface_constant (key , c , ce , iface );
1657
1657
} ZEND_HASH_FOREACH_END ();
1658
1658
1659
1659
ZEND_HASH_MAP_FOREACH_STR_KEY_PTR (& iface -> function_table , key , func ) {
@@ -2206,22 +2206,19 @@ static void do_inherit_trait_constant(zend_string *name, zend_class_constant *c,
2206
2206
{
2207
2207
if (do_trait_constant_check (ce , c , name , traits , current_trait )) {
2208
2208
zend_class_constant * ct = NULL ;
2209
+
2210
+ ct = zend_arena_alloc (& CG (arena ),sizeof (zend_class_constant ));
2211
+ memcpy (ct , c , sizeof (zend_class_constant ));
2212
+ c = ct ;
2213
+
2209
2214
if (Z_TYPE (c -> value ) == IS_CONSTANT_AST ) {
2210
2215
ce -> ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED ;
2211
2216
ce -> ce_flags |= ZEND_ACC_HAS_AST_CONSTANTS ;
2212
2217
if (traits [current_trait ]-> ce_flags & ZEND_ACC_IMMUTABLE ) {
2213
- ct = zend_arena_alloc (& CG (arena ), sizeof (zend_class_constant ));
2214
- memcpy (ct , c , sizeof (zend_class_constant ));
2215
- Z_CONSTANT_FLAGS (ct -> value ) |= CONST_OWNED ;
2218
+ Z_CONSTANT_FLAGS (c -> value ) |= CONST_OWNED ;
2216
2219
}
2217
2220
}
2218
2221
2219
- if (!ct ) {
2220
- ct = emalloc (sizeof (zend_class_constant ));
2221
- memcpy (ct , c , sizeof (zend_class_constant ));
2222
- }
2223
- c = ct ;
2224
-
2225
2222
c -> ce = ce ;
2226
2223
Z_TRY_ADDREF (c -> value );
2227
2224
c -> doc_comment = c -> doc_comment ? zend_string_copy (c -> doc_comment ) : NULL ;
@@ -2274,7 +2271,7 @@ static void zend_do_traits_property_and_constant_binding(zend_class_entry *ce, z
2274
2271
if ((colliding_prop -> flags & flags_mask ) == (flags & flags_mask ) &&
2275
2272
property_types_compatible (property_info , colliding_prop ) == INHERITANCE_SUCCESS
2276
2273
) {
2277
- /* the flags are identical, thus, the properties may be is_compatible */
2274
+ /* the flags are identical, thus, the properties may be compatible */
2278
2275
zval * op1 , * op2 ;
2279
2276
2280
2277
if (flags & ZEND_ACC_STATIC ) {
0 commit comments