Skip to content

Commit 8494092

Browse files
committed
another try
1 parent 1fc9c02 commit 8494092

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Zend/zend_API.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ static zend_always_inline void _object_properties_init(zend_object *object, zend
16071607
if (class_type->default_properties_count) {
16081608
zval *src = CE_DEFAULT_PROPERTIES_TABLE(class_type);
16091609
zval *dst = object->properties_table;
1610-
#if 1
1610+
#if 0
16111611
zval *end = src + class_type->default_properties_count;
16121612
if (UNEXPECTED(class_type->type == ZEND_INTERNAL_CLASS)) {
16131613
// do {
@@ -1634,7 +1634,13 @@ static zend_always_inline void _object_properties_init(zend_object *object, zend
16341634
} else {
16351635
// TODO: assertion?
16361636
/* zend_declare_typed_property() disallows refcounted default property values in internal classes */
1637-
memcpy(dst, src, sizeof(zval) * class_type->default_properties_count);
1637+
// memcpy(dst, src, sizeof(zval) * class_type->default_properties_count);
1638+
zval *end = src + class_type->default_properties_count;
1639+
do {
1640+
ZVAL_COPY_VALUE_PROP(dst, src);
1641+
src++;
1642+
dst++;
1643+
} while (src != end);
16381644
}
16391645
#endif
16401646
}
@@ -4395,9 +4401,9 @@ ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, z
43954401
}
43964402
}
43974403
// printf("%s %s\n", ce->name->val, name->val);
4398-
// if (Z_REFCOUNTED_P(property)) {
4399-
// ce->ce_flags |= ZEND_ACC_HAS_RC_PROPS;
4400-
// }
4404+
if (Z_REFCOUNTED_P(property)) {
4405+
ce->ce_flags |= ZEND_ACC_HAS_RC_PROPS;
4406+
}
44014407
property_default_ptr = &ce->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)];
44024408
ZVAL_COPY_VALUE(property_default_ptr, property);
44034409
Z_PROP_FLAG_P(property_default_ptr) = Z_ISUNDEF_P(property) ? IS_PROP_UNINIT : 0;

Zend/zend_inheritance.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2538,7 +2538,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce, zend_class_ent
25382538
}
25392539
}
25402540
} ZEND_HASH_FOREACH_END();
2541-
// ce->ce_flags |= traits[i]->ce_flags & ZEND_ACC_HAS_RC_PROPS;
2541+
ce->ce_flags |= traits[i]->ce_flags & ZEND_ACC_HAS_RC_PROPS;
25422542
}
25432543
}
25442544
/* }}} */

0 commit comments

Comments
 (0)