From:             joffrey at coolhaven dot info
Operating system: Linux
PHP version:      5.3CVS-2009-03-17 (CVS)
PHP Bug Type:     Scripting Engine problem
Bug description:  func_get_args returns copies of arguments, not referenced 
values

Description:
------------
Calling func_get_args() returns copies of the arguments of the function.
It would be more useful to return referenced values if those are defined in
the function parameters.

This is useful when using func_get_args() for function parameter
overloading and calling other functions from a function using
call_user_func_array().

A bit off topic: I see var_dump is aware if the variable is a referenced
one. Would it be possible to implement a 'is_reference()' function now?

Reproduce code:
---------------
$a = 1;
$b = 2;
$c = "3";

function f($a, &$b, &$c)
  {
  var_dump(func_get_args());
  }

var_dump(array($a, &$b, &$c));

f($a, $b, $c);


Expected result:
----------------
array(3) {
  [0]=>
  int(1)
  [1]=>
  ∫(2)
  [2]=>
  &string(1) "3"
}
array(3) {
  [0]=>
  int(1)
  [1]=>
  ∫(2)
  [2]=>
  &string(1) "3"
}

Actual result:
--------------
array(3) {
  [0]=>
  int(1)
  [1]=>
  ∫(2)
  [2]=>
  &string(1) "3"
}
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  string(1) "3"
}


-- 
Edit bug report at http://bugs.php.net/?id=47693&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47693&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47693&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47693&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47693&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47693&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47693&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47693&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47693&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47693&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47693&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47693&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47693&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47693&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47693&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47693&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47693&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47693&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47693&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47693&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47693&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47693&r=mysqlcfg

Reply via email to