#32429 [Opn->Fbk]: method_exists() always return TRUE if __call method exists
| From: | sniper@php.net | Date: | Wed, 23 Mar 2005 22:58:45 +0000 |
| Subject: | #32429 [Opn->Fbk]: method_exists() always return TRUE if __call method exists | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-75785@lists.php.net to get a copy of this message | ||
ID: 32429
Updated by: sniper@php.net
Reported By: pasha dot zubkov at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: Zend Engine 2 problem
Operating System: Linux 2.6.11-grsec
PHP Version: 5CVS-2005-03-23 (dev)
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2005-03-23 14:43:34] pasha dot zubkov at gmail dot com
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 this bug report at http://bugs.php.net/?id=32429&edit=1