note 77613 added to function.call-user-func-array
| From: | Sc00bz at osu1 dot php dot net | Date: | Wed, 05 Sep 2007 19:11:25 +0000 |
| Subject: | note 77613 added to function.call-user-func-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130226@lists.php.net to get a copy of this message | ||
After looking at "php at paulbutler dot org" comment I tested the hack with a pass by
value function just because I thought it might do something wrong, well it did.
<?php
function setargs($a1, $a2, $a3) // all are pass by value
{
$a1 = "one";
$a2 = "two";
$a3 = "three";
}
$args = array("1","2","3");
$hack = array();
foreach ($args as &$v)
$hack[] =& $v;
call_user_func_array("setargs", $args);
echo implode(" ", $args);
?>
Displays "one two three", instead of the expected "1 2 3".
Someone should really test this on the current version of php and report this bug.
----
Server IP: 69.147.83.197
Probable Submitter: 76.223.111.15
----
Manual Page -- http://www.php.net/manual/en/function.call-user-func-array.php
Edit -- https://master.php.net/note/edit/77613
Del: integrated -- https://master.php.net/note/delete/77613/integrated
Del: useless -- https://master.php.net/note/delete/77613/useless
Del: bad code -- https://master.php.net/note/delete/77613/bad+code
Del: spam -- https://master.php.net/note/delete/77613/spam
Del: non-english -- https://master.php.net/note/delete/77613/non-english
Del: in docs -- https://master.php.net/note/delete/77613/in+docs
Del: other reasons-- https://master.php.net/note/delete/77613
Reject -- https://master.php.net/note/reject/77613
Search -- https://master.php.net/manage/user-notes.php