ID: 49500
Comment by: casper at procurios dot nl
Reported By: casper at procurios dot nl
Status: Open
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 5.3.0
New Comment:
My workaround code has a similar issue:
function workaroundforbug49500_call_user_func()
{
$params = func_get_args();
$func = array_shift($params);
return call_user_func_array($func, $params);
}
Casts: 'PHP warning Parameter 1 to myFunction() expected to be a
reference, value given' too.
func_get_args() seems affected too.
Previous Comments:
------------------------------------------------------------------------
[2009-09-08 15:03:02] casper at procurios dot nl
Description:
------------
When call_user_func is called with an object as it's second parameter,
it's not passed as reference. Instead the PHP warning 'Parameter 1 to
myFunction() expected to be a reference, value given' is cast.
myFunction() is not called at all.
This is a major compatibility break from 5.2.
Reproduce code:
---------------
class MyClass {
var $someVar = 'test';
}
function myFunction(&$Object) {
echo $Object->someVar . "\n";
}
$Object = new MyClass();
myFunction($Object);
call_user_func('myFunction', $Object);
Expected result:
----------------
test
test
Actual result:
--------------
test
PHP warning Parameter 1 to myFunction() expected to be a reference,
value given
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49500&edit=1