|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-12-08 15:06 UTC] jan dot reitz at lanxess dot com
Description:
------------
i have defined a method in 'myClass' named 'myMethod' and it can be called statically.
i cant use call_user_func() because i need to pass a variable by reference and since call_user_func() is a function itself i cant get the variable passed (if i add the "&" to the variable in call_user_func i get a "calltime-pass-by-reference" error in php5, but it works for now)
tried with 4.3.8 and 5.0.3RC1
Reproduce code:
---------------
Generates Error:
<?
$meth = 'myMethod';
is_callable(array('myClass',$meth),null,$callname);
echo $callname($variable);
?>
Works:
<?
echo myClass::myMethod($variable);
?>
Expected result:
----------------
myClass::myMethod() should be called
Actual result:
--------------
PHP Fatal error: Call to undefined function myClass::myMethod() in XXX on line XXX
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 08:00:02 2025 UTC |
It was never supposed to work, so this is not a bug. Use call_user_func_array(Array('MyClass','myMethod'),Array(&$var)); instead.