@@ -1690,7 +1690,7 @@ static bool do_inherit_constant_check(
1690
1690
}
1691
1691
/* }}} */
1692
1692
1693
- static void do_inherit_interface_constant (zend_string * name , zend_class_constant * c , zend_class_entry * ce , zend_class_entry * iface ) /* {{{ */
1693
+ static void do_inherit_iface_constant (zend_string * name , zend_class_constant * c , zend_class_entry * ce , zend_class_entry * iface ) /* {{{ */
1694
1694
{
1695
1695
if (do_inherit_constant_check (ce , c , name )) {
1696
1696
zend_class_constant * ct ;
@@ -1722,7 +1722,7 @@ static void do_interface_implementation(zend_class_entry *ce, zend_class_entry *
1722
1722
zend_class_constant * c ;
1723
1723
1724
1724
ZEND_HASH_MAP_FOREACH_STR_KEY_PTR (& iface -> constants_table , key , c ) {
1725
- do_inherit_interface_constant (key , c , ce , iface );
1725
+ do_inherit_iface_constant (key , c , ce , iface );
1726
1726
} ZEND_HASH_FOREACH_END ();
1727
1727
1728
1728
ZEND_HASH_MAP_FOREACH_STR_KEY_PTR (& iface -> function_table , key , func ) {
@@ -2275,22 +2275,19 @@ static void do_inherit_trait_constant(zend_string *name, zend_class_constant *c,
2275
2275
{
2276
2276
if (do_trait_constant_check (ce , c , name , traits , current_trait )) {
2277
2277
zend_class_constant * ct = NULL ;
2278
+
2279
+ ct = zend_arena_alloc (& CG (arena ),sizeof (zend_class_constant ));
2280
+ memcpy (ct , c , sizeof (zend_class_constant ));
2281
+ c = ct ;
2282
+
2278
2283
if (Z_TYPE (c -> value ) == IS_CONSTANT_AST ) {
2279
2284
ce -> ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED ;
2280
2285
ce -> ce_flags |= ZEND_ACC_HAS_AST_CONSTANTS ;
2281
2286
if (traits [current_trait ]-> ce_flags & ZEND_ACC_IMMUTABLE ) {
2282
- ct = zend_arena_alloc (& CG (arena ), sizeof (zend_class_constant ));
2283
- memcpy (ct , c , sizeof (zend_class_constant ));
2284
- Z_CONSTANT_FLAGS (ct -> value ) |= CONST_OWNED ;
2287
+ Z_CONSTANT_FLAGS (c -> value ) |= CONST_OWNED ;
2285
2288
}
2286
2289
}
2287
2290
2288
- if (!ct ) {
2289
- ct = emalloc (sizeof (zend_class_constant ));
2290
- memcpy (ct , c , sizeof (zend_class_constant ));
2291
- }
2292
- c = ct ;
2293
-
2294
2291
c -> ce = ce ;
2295
2292
Z_TRY_ADDREF (c -> value );
2296
2293
c -> doc_comment = c -> doc_comment ? zend_string_copy (c -> doc_comment ) : NULL ;
@@ -2343,7 +2340,7 @@ static void zend_do_traits_property_and_constant_binding(zend_class_entry *ce, z
2343
2340
if ((colliding_prop -> flags & flags_mask ) == (flags & flags_mask ) &&
2344
2341
property_types_compatible (property_info , colliding_prop ) == INHERITANCE_SUCCESS
2345
2342
) {
2346
- /* the flags are identical, thus, the properties may be is_compatible */
2343
+ /* the flags are identical, thus, the properties may be compatible */
2347
2344
zval * op1 , * op2 ;
2348
2345
2349
2346
if (flags & ZEND_ACC_STATIC ) {
0 commit comments