|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #66212 func-num-args, func-get-arg, func-get-args
Submitted: 2013-12-01 09:22 UTC Modified: 2013-12-01 09:47 UTC
From: Koman at koman dot com dot au Assigned:
Status: Wont fix Package: Built-in web server
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: Koman at koman dot com dot au
New email:
PHP Version: OS:


 [2013-12-01 09:22 UTC] Koman at koman dot com dot au
From manual page:
From manual page: 
From manual page:
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:

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-01 09:47 UTC]
-Status: Open +Status: Wont fix
 [2013-12-01 09:47 UTC]
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.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Sep 30 07:01:25 2023 UTC