diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-08-29 23:41:46 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-08-29 23:41:46 +0300 |
commit | 19376453e8087e67e0673aae6658bd0d2e91bfd6 (patch) | |
tree | 3a0fd252164706224dd15c8aff33ac7d95e87ee8 /Zend/zend_inheritance.c | |
parent | ef12e9621517ba33f11c6983c607fae56cefc54a (diff) | |
parent | 566a75e97c7df74d3172b0b8442d857105123135 (diff) | |
download | php-git-19376453e8087e67e0673aae6658bd0d2e91bfd6.tar.gz |
Merge branch 'PHP-7.3'
* PHP-7.3:
Fixed incorrect ZEND_ACC_ARENA_ALLOCATED usage (it must be used only for internal functions).
Diffstat (limited to 'Zend/zend_inheritance.c')
-rw-r--r-- | Zend/zend_inheritance.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 59db678b09..df48108bfe 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -1322,10 +1322,15 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s } } - function_add_ref(fn); - new_fn = zend_arena_alloc(&CG(arena), sizeof(zend_op_array)); - memcpy(new_fn, fn, sizeof(zend_op_array)); - new_fn->common.fn_flags |= ZEND_ACC_ARENA_ALLOCATED; + if (UNEXPECTED(fn->type == ZEND_INTERNAL_FUNCTION)) { + new_fn = zend_arena_alloc(&CG(arena), sizeof(zend_internal_function)); + memcpy(new_fn, fn, sizeof(zend_internal_function)); + new_fn->common.fn_flags |= ZEND_ACC_ARENA_ALLOCATED; + } else { + function_add_ref(fn); + new_fn = zend_arena_alloc(&CG(arena), sizeof(zend_op_array)); + memcpy(new_fn, fn, sizeof(zend_op_array)); + } fn = zend_hash_update_ptr(&ce->function_table, key, new_fn); zend_add_magic_methods(ce, key, fn); } |