php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48106 func_get_args() causes Fatal Error when used as second function parameter
Submitted: 2009-04-29 12:09 UTC Modified: 2009-04-29 12:24 UTC
From: djungowski at chip dot de Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.9 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: djungowski at chip dot de
New email:
PHP Version: OS:

 

 [2009-04-29 12:09 UTC] djungowski at chip dot de
Description:
------------
When func_get_args() is used as second (or third or fourth...) parameter in a function/method call, it causes a Fatal error. Yet when used as first parameter, everything works fine.

No fatal error occurs when any other function is used as second parameter, so it seems to be a func_get_args() problem only.

This problem also occurs in earlier PHP versions (5.2.6, 5.2.4, etc)

I know this bug has been reported before (#27887), but has been closed with a - I'm sorry to say this - lame explanation. This is a bug, no matter what the documentation says.

Reproduce code:
---------------
function returnSomething()
{
        return func_get_args();
}

function callSomeFunction($message)
{
        someFunction(func_get_args(), 'Hello World');
        someFunction(1, returnSomething());
        someFunction(1, func_get_args());
}

function someFunction($code, $message)
{
        print($message . PHP_EOL);
}

callSomeFunction('Hello World');

Expected result:
----------------
Hello World
Array
Array

Actual result:
--------------
Hello World
Array

Fatal error: func_get_args(): Can't be used as a function parameter in /home/dominik/test.php on line 12

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-29 12:24 UTC] kalle@php.net
This is a known issue and have been fixed in 5.3.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Aug 18 13:00:02 2025 UTC