#31023 [NEW]: $var = "myClass::myMethod"; echo $var(); does generate Error
From: jan dot reitz at lanxess dot com
Operating system: Windows 2000
PHP version: Irrelevant
PHP Bug Type: Class/Object related
Bug description: $var = "myClass::myMethod"; echo $var(); does generate Error
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
--
Edit bug report at http://bugs.php.net/?id=31023&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31023&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31023&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31023&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31023&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31023&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31023&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31023&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31023&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31023&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31023&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31023&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31023&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31023&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31023&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31023&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31023&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31023&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31023&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31023&r=mysqlcfg
Thread (3 messages)
- jan dot reitz at lanxess dot com