There's a strange bug in PHP we recently came across: When using func_get_args() is used as second (or third or fourth etc) parameter, PHP crashes with a Fatal Error.
Try this code:
someFunction(func_get_args(), 'Hello World');
function someFunction($code, $message)
print($message . PHP_EOL);
The result should be
yet you get
Fatal error: func_get_args(): Can't be used as a function parameter
in /home/dominik/test.php on line 12
The code works with any other function (see example code), only func_get_args() causes a crash.
So I thought: Let's commit a bug! I then found out that this very bug has already been committed in 2005: http://bugs.php.net/bug.php?id=27887. The bug was closed (unfixed) with this really unsatisfactory explanation:
[16 Jun 2005 1:34am UTC] firstname.lastname@example.org
Damien, the docs say: "This function cannot be used directly as a function
parameter. Instead, its result may be assigned to a variable, which can
then be passed to the function.", so don't use it as a parameter.
[16 Jun 2005 9:04am UTC] email@example.com
So there is no bug, and the docs already describe it -> bogus.
Of course: Why should I fix a bug, when I can just put a note in the documentation that says "don't use it as parameter".
Edit: I filed a bug and it was closed with the comment "This is a known issue and have been fixed in 5.3.". Good to know!