Bug #63111 [Asn->Csd]: is_callable() lies for abstract static method
| From: | dmitry@php.net | Date: | Fri, 21 Sep 2012 11:17:57 +0000 |
| Subject: | Bug #63111 [Asn->Csd]: is_callable() lies for abstract static method | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-173606@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63111&edit=1
ID: 63111
Updated by: dmitry@php.net
Reported by: vovan-ve at yandex dot ru
Summary: is_callable() lies for abstract static method
-Status: Assigned
+Status: Closed
Type: Bug
Package: Class/Object related
PHP Version: Irrelevant
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4db74b7f1981bf19805e815f983c50d93df2c26a
Log: Fixed bug #63111 (is_callable() lies for abstract static method)
Previous Comments:
------------------------------------------------------------------------
[2012-09-18 16:09:13] laruence@php.net
seems similar with #36635
------------------------------------------------------------------------
[2012-09-18 15:57:05] laruence@php.net
hmm, dmitry could you please look at this? thanks
------------------------------------------------------------------------
[2012-09-18 15:07:48] vovan-ve at yandex dot ru
Description:
------------
The function is_callable() says, that abstract static method _IS_ callable. But it is abstract, it
has no body.
abstract class Foo {
abstract static function bar();
}
# PHP Strict Standards: Static function Foo::bar() should not be abstract
# is Foo::bar() callable?
var_dump( is_callable(array("Foo", "bar")) );
# bool(true)
# O_o Ok, let's try...
Foo::bar();
# Fatal error: Cannot call abstract method Foo::bar()
Yes, I see a Strict. Anyway, is_callable() lies. I have checked this in 5.3.10, 5.3.6 and 5.2.17.
Test script:
---------------
abstract class Foo {
abstract static function bar();
}
var_dump( is_callable(array("Foo", "bar")) );
Foo::bar();
Expected result:
----------------
bool(false)
Fatal error
Actual result:
--------------
bool(true)
Fatal error
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63111&edit=1