#37351 [Opn->Bgs]: func_get_args() does not return variables by reference

From: Date: Sat, 16 Feb 2008 17:58:51 +0000
Subject: #37351 [Opn->Bgs]: func_get_args() does not return variables by reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-122350@lists.php.net to get a copy of this message
ID: 37351 Updated by: johannes@php.net Reported By: chris at starglade dot org -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: Any PHP Version: 5.1.4 New Comment: . Previous Comments: ------------------------------------------------------------------------ [2008-02-16 17:58:14] johannes@php.net By the time func_get_args() is being called the parameters were already passed to the function, it's too late for making them references. You might work-aroudn this limitation by wrapping references in an array or using objects. ------------------------------------------------------------------------ [2008-02-15 14:42:04] thomas at koch dot ro is the same as http://bugs.php.net/bug.php?id=6427 ------------------------------------------------------------------------ [2006-05-07 18:49:53] chris at starglade dot org Description: ------------ func_get_args() and func_get_arg() should return variables by reference. Reproduce code: --------------- <?php $one = 'one'; $two = 'two'; $three = 'three'; function change_one_into_two_normal(&$var) { $var = 'two'; } function change_one_into_two_using_get_args() { $args = func_get_args(); $args[0] = 'two'; } change_one_into_two_normal($one); echo $one; $one = 'one'; change_one_into_two_using_get_args($one); echo $one; Expected result: ---------------- two one Actual result: -------------- two two ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37351&edit=1

« previous php.bugs (#122350) next »