From: william at 1moment dot nl Operating system: Linux PHP version: 5.2SVN-2009-08-11 (SVN) PHP Bug Type: Class/Object related Bug description: method_exists check goes wrong when checking for a static function
Description: ------------ The method_exists function can have two types of input for the first parameter: An object instance or a class name. The documentation (http://us2.php.net/manual/en/function.method-exists.php) has two examples. One for checking static methods and one for checking normal methods. (Based on the type of var for the first parameter). When i do this in php version 5.2.5 the code below will echo 'testClass has a static function named testFunction'. When i do this in php version 5.0.4 the code below will echo 'testClass has not a static function named testFunction'. I think 5.0.4 is correct behavior. Thnx! Reproduce code: --------------- Class testClass { public function testFunction() { return true; } } if(method_exists('testClass', 'testFunction')) { echo 'testClass has a static function named testFunction'; } else { echo 'testClass has not a static function named testFunction'; } Expected result: ---------------- testClass has a static function named testFunction Actual result: -------------- testClass has not a static function named testFunction -- Edit bug report at http://bugs.php.net/?id=49220&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49220&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49220&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49220&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49220&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49220&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49220&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49220&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49220&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49220&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49220&r=support Expected behavior: http://bugs.php.net/fix.php?id=49220&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49220&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49220&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49220&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49220&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49220&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49220&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49220&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49220&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49220&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49220&r=mysqlcfg