Edit report at https://bugs.php.net/bug.php?id=63071&edit=1

 ID:                 63071
 Updated by:         larue...@php.net
 Reported by:        maarten at ba dot be
 Summary:            func_get_args loses byref information
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   all
 PHP Version:        5.3.16
 Block user comment: N
 Private report:     N

 New Comment:

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

"Returns an array in which each element is a copy of the corresponding member 
of 
the current user-defined function's argument list."

http://us2.php.net/manual/en/function.func-get-args.php


Previous Comments:
------------------------------------------------------------------------
[2012-09-12 11:00:08] maarten at ba dot be

Description:
------------
i'm writing code that invokes "hooks" with byref parameters.

but the generalized hook functions lose the byref information due to 
func_get_args being a copy (but not exact), thus call_user_func_array() (which 
needs to have references in it's array) can't work.

see shortened example below:

Test script:
---------------
$foo = "foo";
$bar = "bar";
function func_a(&$a, $b) {
  $a = $b;
};
function c() {
  $args = func_get_args();
  call_user_func_array("func_a", $args);
};
c(&$foo, $bar);
var_dump($foo);

Expected result:
----------------
i expected for $foo to have 'bar'

Actual result:
--------------
$foo is still 'foo', and a warning is generated


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63071&edit=1

Reply via email to