#32429 [NEW]: method_exists() always return TRUE if __call method exists
| From: | pasha dot zubkov at gmail dot com | Date: | Wed, 23 Mar 2005 13:43:34 +0000 |
| Subject: | #32429 [NEW]: method_exists() always return TRUE if __call method exists | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-75753@lists.php.net to get a copy of this message | ||
From: pasha dot zubkov at gmail dot com
Operating system: Linux 2.6.11-grsec
PHP version: 5CVS-2005-03-23 (dev)
PHP Bug Type: *General Issues
Bug description: method_exists() always return TRUE if __call method exists
Description:
------------
See example. I can't use
if (method_exists()) {} because it always
return TRUE
Reproduce code:
---------------
<?php
class TestClass {
public function __construct() {
var_dump(method_exists($this, 'test'));
if (method_exists($this, 'test')) {
$this->test();
}
}
public function __call($name, $args) {
throw new Exception('Call to undefined method
'.get_class($this).'::'.$name.'()');
}
}
try {
$test = new TestClass;
} catch (Exception $e) {
exit($e->getMessage());
}
?>
Expected result:
----------------
bool(false)
Actual result:
--------------
bool(true) Call to undefined method TestClass::test()
--
Edit bug report at http://bugs.php.net/?id=32429&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32429&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32429&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32429&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32429&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32429&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32429&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32429&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32429&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32429&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32429&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32429&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32429&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32429&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32429&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32429&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32429&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32429&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32429&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32429&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32429&r=mysqlcfg