summaryrefslogtreecommitdiff
path: root/Zend/zend_inheritance.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_inheritance.c')
-rw-r--r--Zend/zend_inheritance.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 2226f6013d..e3ef6a6991 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -724,15 +724,15 @@ static void do_inherit_class_constant(zend_string *name, zend_class_constant *pa
if (Z_CONSTANT(parent_const->value)) {
ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
}
- if (Z_REFCOUNTED(parent_const->value)) {
- Z_ADDREF(parent_const->value);
- }
if (ce->type & ZEND_INTERNAL_CLASS) {
+ if (Z_REFCOUNTED(parent_const->value)) {
+ Z_ADDREF(parent_const->value);
+ }
c = pemalloc(sizeof(zend_class_constant), 1);
+ memcpy(c, parent_const, sizeof(zend_class_constant));
} else {
- c = zend_arena_alloc(&CG(arena), sizeof(zend_class_constant));
+ c = parent_const;
}
- memcpy(c, parent_const, sizeof(zend_class_constant));
_zend_hash_append_ptr(&ce->constants_table, name, c);
}
}
@@ -934,18 +934,18 @@ static void do_inherit_iface_constant(zend_string *name, zend_class_constant *c,
{
if (do_inherit_constant_check(&ce->constants_table, c, name, iface)) {
zend_class_constant *ct;
- if (Z_REFCOUNTED(c->value)) {
- Z_ADDREF(c->value);
- }
if (Z_CONSTANT(c->value)) {
ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
}
if (ce->type & ZEND_INTERNAL_CLASS) {
+ if (Z_REFCOUNTED(c->value)) {
+ Z_ADDREF(c->value);
+ }
ct = pemalloc(sizeof(zend_class_constant), 1);
+ memcpy(ct, c, sizeof(zend_class_constant));
} else {
- ct = zend_arena_alloc(&CG(arena), sizeof(zend_class_constant));
+ ct = c;
}
- memcpy(ct, c, sizeof(zend_class_constant));
zend_hash_update_ptr(&ce->constants_table, name, ct);
}
}