#34678 [Asn->Csd]: __call(), is_callable() and static methods
| From: | dmitry@php.net | Date: | Mon, 03 Oct 2005 09:17:48 +0000 |
| Subject: | #34678 [Asn->Csd]: __call(), is_callable() and static methods | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-85924@lists.php.net to get a copy of this message | ||
ID: 34678
Updated by: dmitry@php.net
Reported By: bmansion at mamasam dot com
-Status: Assigned
+Status: Closed
Bug Type: Class/Object related
Operating System: *
PHP Version: 5CVS-2005-10-01
Assigned To: dmitry
New Comment:
Fixed in CVS HEAD, PHP_5_1 and PHP_5_0.
Previous Comments:
------------------------------------------------------------------------
[2005-10-02 00:03:30] sniper@php.net
Dmitry, check this out.
------------------------------------------------------------------------
[2005-10-01 17:48:25] bmansion at mamasam dot com
Same problem with the snapshot.
------------------------------------------------------------------------
[2005-09-29 13:14:03] 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-09-29 11:57:39] bmansion at mamasam dot com
Description:
------------
I think is_callable() should check for existing methods instead of
returning true all the time when the class uses overloading. Otherwise
it becomes useless.
This is IMO particularly true for static methods checks, since __call
is defined as non-static.
Reproduce code:
---------------
class A {
public function __call($m, $a) {
}
}
class B extends A {
public static function foo() {
echo 'foo';
}
}
if (is_callable(array('A', 'foo'))) {
call_user_func(array('A', 'foo'));
}
Expected result:
----------------
Outputs nothing.
Actual result:
--------------
Fatal error: Call to undefined method A::foo()
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34678&edit=1