Skip to content

Commit 53a687d

Browse files
committed
Copy function attributes in function_copy_ctor()
1 parent 3225066 commit 53a687d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Zend/zend.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,22 @@ static void function_copy_ctor(zval *zv) /* {{{ */
665665
}
666666
func->common.arg_info = new_arg_info + 1;
667667
}
668+
if (old_func->common.attributes) {
669+
zend_attribute *old_attr;
670+
671+
func->common.attributes = NULL;
672+
673+
ZEND_HASH_PACKED_FOREACH_PTR(old_func->common.attributes, old_attr) {
674+
uint32_t i;
675+
zend_attribute *attr;
676+
677+
attr = zend_add_attribute(&func->common.attributes, old_attr->name, old_attr->argc, old_attr->flags, old_attr->offset, old_attr->lineno);
678+
679+
for (i = 0 ; i < old_attr->argc; i++) {
680+
ZVAL_DUP(&attr->args[i].value, &old_attr->args[i].value);
681+
}
682+
} ZEND_HASH_FOREACH_END();
683+
}
668684
}
669685
/* }}} */
670686

0 commit comments

Comments
 (0)