php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch add_call_proxy_flag.patch for Scripting Engine problem Bug #64987

Patch version 2013-06-09 09:00 UTC

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

Developer: laruence@php.net

diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index f10fc91..e637887 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -75,6 +75,7 @@ typedef struct _zend_fcall_info_cache {
 
 #define ZEND_NAMED_FE(zend_name, name, arg_info)	ZEND_FENTRY(zend_name, name, arg_info, 0)
 #define ZEND_FE(name, arg_info)						ZEND_FENTRY(name, ZEND_FN(name), arg_info, 0)
+#define ZEND_FE_EX(name, arg_info, flags)           ZEND_FENTRY(name, ZEND_FN(name), arg_info, flags|ZEND_ACC_PUBLIC)
 #define ZEND_DEP_FE(name, arg_info)                 ZEND_FENTRY(name, ZEND_FN(name), arg_info, ZEND_ACC_DEPRECATED)
 #define ZEND_FALIAS(name, alias, arg_info)			ZEND_FENTRY(name, ZEND_FN(alias), arg_info, 0)
 #define ZEND_DEP_FALIAS(name, alias, arg_info)		ZEND_FENTRY(name, ZEND_FN(alias), arg_info, ZEND_ACC_DEPRECATED)
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 47fb4d2..e573293 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -2197,7 +2197,10 @@ ZEND_FUNCTION(debug_print_backtrace)
 
 			while (prev) {
 				if (prev->function_state.function &&
-					prev->function_state.function->common.type != ZEND_USER_FUNCTION) {
+					prev->function_state.function->common.type != ZEND_USER_FUNCTION &&
+					!(prev->function_state.function->common.type == ZEND_INTERNAL_FUNCTION &&
+						((prev->function_state.function->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) ||
+						(prev->function_state.function->common.fn_flags & ZEND_ACC_CALL_PROXY)))) {
 					prev = NULL;
 					break;
 				}				    
@@ -2278,7 +2281,8 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
 				if (prev->function_state.function &&
 					prev->function_state.function->common.type != ZEND_USER_FUNCTION &&
 					!(prev->function_state.function->common.type == ZEND_INTERNAL_FUNCTION &&
-						(prev->function_state.function->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER))) {
+						((prev->function_state.function->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) ||
+						(prev->function_state.function->common.fn_flags & ZEND_ACC_CALL_PROXY)))) {
 					break;
 				}				    
 				if (prev->op_array) {
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 9c55b5e..fe4fc22 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -197,7 +197,6 @@ typedef struct _zend_try_catch_element {
 /* user class has methods with static variables */
 #define ZEND_HAS_STATIC_IN_METHODS    0x800000
 
-
 #define ZEND_ACC_CLOSURE              0x100000
 #define ZEND_ACC_GENERATOR            0x800000
 
@@ -207,6 +206,9 @@ typedef struct _zend_try_catch_element {
 /* disable inline caching */
 #define ZEND_ACC_NEVER_CACHE          0x400000
 
+/* function falg for internal user proxy call handlers call_user_func */
+#define ZEND_ACC_CALL_PROXY           0x10000000
+
 #define ZEND_ACC_PASS_REST_BY_REFERENCE 0x1000000
 #define ZEND_ACC_PASS_REST_PREFER_REF	0x2000000
 
@@ -215,7 +217,6 @@ typedef struct _zend_try_catch_element {
 
 char *zend_visibility_string(zend_uint fn_flags);
 
-
 typedef struct _zend_property_info {
 	zend_uint flags;
 	const char *name;
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index b65ccaa..5e8091a 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -5744,8 +5744,8 @@ static const zend_function_entry reflection_function_functions[] = {
 	ZEND_ME(reflection_function, __toString, arginfo_reflection__void, 0)
 	ZEND_ME(reflection_function, export, arginfo_reflection_function_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
 	ZEND_ME(reflection_function, isDisabled, arginfo_reflection__void, 0)
-	ZEND_ME(reflection_function, invoke, arginfo_reflection_function_invoke, 0)
-	ZEND_ME(reflection_function, invokeArgs, arginfo_reflection_function_invokeArgs, 0)
+	ZEND_ME(reflection_function, invoke, arginfo_reflection_function_invoke, ZEND_ACC_CALL_PROXY|ZEND_ACC_PUBLIC)
+	ZEND_ME(reflection_function, invokeArgs, arginfo_reflection_function_invokeArgs, ZEND_ACC_CALL_PROXY|ZEND_ACC_PUBLIC)
 	ZEND_ME(reflection_function, getClosure, arginfo_reflection__void, 0)
 	PHP_FE_END
 };
@@ -5793,8 +5793,8 @@ static const zend_function_entry reflection_method_functions[] = {
 	ZEND_ME(reflection_method, isDestructor, arginfo_reflection__void, 0)
 	ZEND_ME(reflection_method, getClosure, arginfo_reflection_method_getClosure, 0)
 	ZEND_ME(reflection_method, getModifiers, arginfo_reflection__void, 0)
-	ZEND_ME(reflection_method, invoke, arginfo_reflection_method_invoke, 0)
-	ZEND_ME(reflection_method, invokeArgs, arginfo_reflection_method_invokeArgs, 0)
+	ZEND_ME(reflection_method, invoke, arginfo_reflection_method_invoke, ZEND_ACC_CALL_PROXY|ZEND_ACC_PUBLIC)
+	ZEND_ME(reflection_method, invokeArgs, arginfo_reflection_method_invokeArgs, ZEND_ACC_CALL_PROXY|ZEND_ACC_PUBLIC)
 	ZEND_ME(reflection_method, getDeclaringClass, arginfo_reflection__void, 0)
 	ZEND_ME(reflection_method, getPrototype, arginfo_reflection__void, 0)
 	ZEND_ME(reflection_property, setAccessible, arginfo_reflection_method_setAccessible, 0)
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 9c91404..06fcc46 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -2983,11 +2983,11 @@ const zend_function_entry basic_functions[] = { /* {{{ */
 
 	PHP_FE(error_log,														arginfo_error_log)
 	PHP_FE(error_get_last,													arginfo_error_get_last)
-	PHP_FE(call_user_func,													arginfo_call_user_func)
-	PHP_FE(call_user_func_array,											arginfo_call_user_func_array)
+	PHP_FE_EX(call_user_func,				arginfo_call_user_func,			ZEND_ACC_CALL_PROXY)
+	PHP_FE_EX(call_user_func_array,			arginfo_call_user_func_array,   ZEND_ACC_CALL_PROXY)
 	PHP_DEP_FE(call_user_method,											arginfo_call_user_method)
 	PHP_DEP_FE(call_user_method_array,										arginfo_call_user_method_array)
-	PHP_FE(forward_static_call,											arginfo_forward_static_call)
+	PHP_FE_EX(forward_static_call,			arginfo_forward_static_call,	ZEND_ACC_CALL_PROXY)
 	PHP_FE(forward_static_call_array,										arginfo_forward_static_call_array)
 	PHP_FE(serialize,														arginfo_serialize)
 	PHP_FE(unserialize,														arginfo_unserialize)
diff --git a/main/php.h b/main/php.h
index 7c1f8fd..4fdb3ae 100644
--- a/main/php.h
+++ b/main/php.h
@@ -347,6 +347,7 @@ END_EXTERN_C()
 #define PHP_RAW_NAMED_FE ZEND_RAW_NAMED_FE
 #define PHP_NAMED_FE	ZEND_NAMED_FE
 #define PHP_FE			ZEND_FE
+#define PHP_FE_EX		ZEND_FE_EX
 #define PHP_DEP_FE      ZEND_DEP_FE
 #define PHP_FALIAS		ZEND_FALIAS
 #define PHP_DEP_FALIAS	ZEND_DEP_FALIAS
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 17:01:29 2024 UTC