php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #69579
Patch extension_trait_issue_2.patch revision 2015-05-06 02:20 UTC by jbboehr at gmail dot com

Patch extension_trait_issue_2.patch for Unknown/Other Function Bug #69579

Patch version 2015-05-06 02:20 UTC

Return to Bug #69579 | Download this patch
Patch Revisions:

Developer: jbboehr@gmail.com

diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index f32c55a..d429d09 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -1121,6 +1121,7 @@ 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;
 	fn = zend_hash_update_ptr(&ce->function_table, key, new_fn);
 	zend_add_magic_methods(ce, key, fn);
 }
@@ -1181,7 +1182,11 @@ static int zend_traits_copy_functions(zend_string *fnname, zend_function *fn, ze
 
 	if (exclude_table == NULL || zend_hash_find(exclude_table, fnname) == NULL) {
 		/* is not in hashtable, thus, function is not to be excluded */
-		fn_copy = *fn;
+		if( fn->type == ZEND_INTERNAL_FUNCTION ) {
+			memcpy(&fn_copy, fn, sizeof(zend_internal_function));
+		} else {
+			fn_copy = *fn;
+		}
 
 		/* apply aliases which have not alias name, just setting visibility */
 		if (ce->trait_aliases) {
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 04 03:01:30 2024 UTC