php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44130 func_get_args should return references
Submitted: 2008-02-15 13:41 UTC Modified: 2008-02-15 14:25 UTC
From: thomas at koch dot ro Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.4.8 OS: Debian
Private report: No CVE-ID: None
 [2008-02-15 13:41 UTC] thomas at koch dot ro
Description:
------------
THIS IS MY FIRST REPORT! PLEASE DON'T BANG ME!

I'd like to use func_get_args to manipulate variables sent by reference. I encountered this problem(?) by evaluating ezcSignalSlot[1]. There you find:

        $parameters = array_slice( func_get_args(), 1 );
        call_user_func_array( $callback, $parameters );

It would be fine, if I could use the combination of this methods to pipe references to normal variables.

[1] http://ezcomponents.org/docs/tutorials/SignalSlot

Reproduce code:
---------------
function test(  )
{
    $args =& func_get_args();
    $args[0]++;
}
$i=1;
test( &$i );
echo $i;

Expected result:
----------------
2

Actual result:
--------------
1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-15 14:25 UTC] felipe@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Says the documentation:

  Note: This function returns a copy of the passed arguments only, and does not account for default (non-passed) arguments.

http://docs.php.net/func-get-args
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Dec 10 10:00:01 2025 UTC