Req #51179 [Opn->Bgs]: call_user_func() should take parameters by reference
Edit report at http://bugs.php.net/bug.php?id=51179&edit=1
ID: 51179
Updated by: jani@php.net
Reported by: info at fedushin dot ru
Summary: call_user_func() should take parameters by reference
-Status: Open
+Status: Bogus
Type: Feature/Change Request
Package: Unknown/Other Function
PHP Version: 5.2.13
New Comment:
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same.
Thank you for your interest in PHP.
The bug db is full of these reports. Next time, search first.
Previous Comments:
------------------------------------------------------------------------
[2010-03-02 02:19:48] info at fedushin dot ru
Description:
------------
Currently it's impossible to pass variable by reference to user callback
through call_user_func().
There's plenty of complaints about it on the Web.
Such missing possibility would be very useful.
As said in Bug #17309, the situation is not a bug because
call_user_func() takes its parameters by value.
Suggestion is to change call_user_func() signature & make it take 2nd &
following parameters by reference.
Test script:
---------------
<?php
function foo(&$arg) {
$arg++;
}
$var = 0;
call_user_func("foo", $var);
echo $var; // echoes 0 instead of 1.
?>
Expected result:
----------------
1
Actual result:
--------------
0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51179&edit=1
Thread (2 messages)