Req #66212 [Opn->Wfx]: func-num-args, func-get-arg, func-get-args

From: Date: Sun, 01 Dec 2013 09:47:36 +0000
Subject: Req #66212 [Opn->Wfx]: func-num-args, func-get-arg, func-get-args
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183039@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66212&edit=1 ID: 66212 Updated by: bwoebi@php.net Reported by: Koman at koman dot com dot au Summary: func-num-args, func-get-arg, func-get-args -Status: Open +Status: Wont fix Type: Feature/Change Request Package: Built-in web server Operating System: Linux PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Includes and requires are also some sort of a function call. Just with no arguments, but with symbol table sharing. I'd consider in your specific case to just use $args = func_get_args(); in test_function and operate in the includes on this variable. Previous Comments: ------------------------------------------------------------------------ [2013-12-01 09:22:16] Koman at koman dot com dot au Description: ------------ --- From manual page: http://www.php.net/function.func-num-args From manual page: http://www.php.net/function.func-get-arg From manual page: http://www.php.net/function.func-get-args --- As indicated in the documentation, versions after 5.3.0 generates a warning and returns -1 when used from within an include or require call. Because, I've found these functions really useful for generating debug files in complex algorythms in variable data sets, I think you should return back to the functionality prior to versions 5.3.0. Or, alternatively, organise someting along the lines of :- Test script: --------------- <?php function test_function ( &$data_list ) { static $function_name_or_handle = __FUNCTION__; $debug_data = array (); include ( vars_initial.php ); . . test algorythm . . include ( vars_final.php ); } ?> vars_initial.php and vars_final.php would utilise :- func-num-args ( [ $function_name_or_handle ] ); func_get_arg ( $arg_num, [ $function_name_or_handle ] ); func_get_args ( [ $function_name_or_handle ] ); to generate data that is used to compile a debug report. If no $function_name_or_handle is supplied then the current function is used or a warning is generated when called from within an include or require call. Expected result: ---------------- To be able to generate valid data from :- func-num-args (); func_get_arg (); func_get_args (); when called from within a include or require construct. Actual result: -------------- Error/Warning Messages. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66212&edit=1

« previous php.bugs (#183039) next »