php.net |  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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-12-01 09:22 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-01 09:47 UTC] bwoebi@php.net
-Status: Open +Status: Wont fix
 [2013-12-01 09:47 UTC] bwoebi@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 16:01:28 2024 UTC