Edit report at https://bugs.php.net/bug.php?id=64987&edit=1
ID: 64987 Updated by: dmi...@php.net Reported by: tyr...@php.net Summary: unexpected result for call_user_func() in the debug_backtrace() Status: Assigned Type: Bug Package: Scripting Engine problem Operating System: irrelevant PHP Version: 5.3.26 Assigned To: laruence Block user comment: N Private report: N New Comment: In my opinion, the current implementation is the right one. It follows the simple rule: when we call some function from an internal one we don't track file name and line number (just because we don't have PHP source for it). I don't think we need to fix this behaviour. Thanks. Dmitry. Previous Comments: ------------------------------------------------------------------------ [2013-06-09 09:02:35] larue...@php.net A patch is added, introduced a new fn_flag ZEND_ACC_CALL_PROXY, applies to call_user_func, call_user_func_array, forward_static_call, reflectionMethod- >invoke etc and this only flag should only affects debug_backtrace handling ... thanks ------------------------------------------------------------------------ [2013-06-09 09:00:08] larue...@php.net The following patch has been added/updated: Patch Name: add_call_proxy_flag.patch Revision: 1370768408 URL: https://bugs.php.net/patch-display.php?bug=64987&patch=add_call_proxy_flag.patch&revision=1370768408 ------------------------------------------------------------------------ [2013-06-07 17:15:45] larue...@php.net hmm, I may find a solution, use tricky ZEND_CALL_VIA_HANDLER fn_flags, for call_user_func, may like: $ git diff diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 9c91404..03f836e 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -2983,7 +2983,7 @@ 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) + ZEND_FENTRY(call_user_func, ZEND_FN(call_user_func), arginfo_call_user_func, ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_ PUBLIC) PHP_FE(call_user_func_array, arginfo_call_user_func_array) PHP_DEP_FE(call_user_method, arginfo_call_user_method) PHP_DEP_FE(call_user_method_array, arginfo_call_user_method_array) ------------------------------------------------------------------------ [2013-06-07 17:08:16] larue...@php.net I understood your point, I just don't know how to fix other related functions once. call_user_func, call_method, reflectionmethod->invoke, reflectionFunction->invoke etc. ------------------------------------------------------------------------ [2013-06-07 14:05:34] tyr...@php.net from the userland developer POV (=debug_backtrace() target audience) the foo call happens in the call_user_func line. generating bogus entry because we unintentionally leak implementation details to the userland is a bad thing imo. I agree that the fixing this via allowing all zend functions to fetch the info from the previous frame would be a bad thing, but it wasn't my intention to suggest that. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=64987 -- Edit this bug report at https://bugs.php.net/bug.php?id=64987&edit=1