#32429 [Ver]: method_exists() always return TRUE if __call method exists

From: Date: Tue, 29 Mar 2005 05:49:52 +0000
Subject: #32429 [Ver]: method_exists() always return TRUE if __call method exists
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-75962@lists.php.net to get a copy of this message
ID: 32429 User updated by: pasha dot zubkov at gmail dot com Reported By: pasha dot zubkov at gmail dot com Status: Verified Bug Type: Zend Engine 2 problem Operating System: Linux 2.6.11-grsec -PHP Version: 5CVS-2005-03-23 (dev) +PHP Version: 5CVS-2005-03-29 (dev) New Comment: Any solution for this bag? Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#75962) next »