php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #30207 problem with func_get_args()
Submitted: 2004-09-23 13:49 UTC Modified: 2004-09-23 20:15 UTC
From: guth at fiifo dot u-psud dot fr Assigned: sean (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.0.1 OS: Linux (mandrake 10)
Private report: No CVE-ID: None
 [2004-09-23 13:49 UTC] guth at fiifo dot u-psud dot fr
Description:
------------
(bad english...)

There is a problem with functions func_[a-z]+_arg[s]?\(\).
The problem can be a documentation error, a PHP bug, or  a feature request (at your choice).

I think that func_get_args()  should return facultative arguments.
So if it is not a bug, please transform this bug report in a Feature / Change request.
It can also be an documentation fix. The actual behavior should be documented.


Reproduce code:
---------------
<?php
function haricow($a, $b = 1) {
   echo func_num_args();
   var_dump(func_get_args());
}

haricow(1);


Expected result:
----------------
2
array(2) { [0] => int(1),  [1] => int(1) }

Actual result:
--------------
1
array(1) { [0] => int(1) }

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-23 14:47 UTC] derick@php.net
No bug here, func_get_args() returns the arguments *passed* to the functoin.
 [2004-09-23 14:55 UTC] derick@php.net
No bug here, func_get_args() returns the arguments *passed* to the functoin.
 [2004-09-23 15:06 UTC] guth at fiifo dot u-psud dot fr
There is a documentation error then.

"Returns an array in which each element is the corresponding member of the current user-defined function's argument list." doesn't mean "arguments passed to the function".

For function haricow(), a list of arguments would be { $a, $b }
 [2004-09-23 18:56 UTC] derick@php.net
Correct, changing to documentation problem.
 [2004-09-23 20:15 UTC] sean@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 23:01:33 2025 UTC