#32429 [Ver->Csd]: method_exists() always return TRUE if __call method exists
ID: 32429
Updated by: dmitry@php.net
Reported By: pasha dot zubkov at gmail dot com
-Status: Verified
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: Linux 2.6.11-grsec
PHP Version: 5CVS-2005-03-29 (dev)
New Comment:
Fixed in CVS HEAD.
Previous Comments:
------------------------------------------------------------------------
[2005-03-29 07:49:51] pasha dot zubkov at gmail dot com
Any solution for this bag?
------------------------------------------------------------------------
[2005-03-24 14:20:44] pasha dot zubkov at gmail dot com
I checkout HEAD from cvs. Problem not solved.
------------------------------------------------------------------------
[2005-03-24 00:27:55] tony2001@php.net
Confirmed with HEAD only.
------------------------------------------------------------------------
[2005-03-23 23:58:44] sniper@php.net
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
------------------------------------------------------------------------
[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
Thread (6 messages)