#48899 [Asn->Csd]: is_callable returns true even if method does not exist in parent class
| From: | felipe@php.net | Date: | Wed, 15 Jul 2009 01:11:42 +0000 |
| Subject: | #48899 [Asn->Csd]: is_callable returns true even if method does not exist in parent class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-139745@lists.php.net to get a copy of this message | ||
ID: 48899
Updated by: felipe@php.net
Reported By: hm at mkjc dot net
-Status: Assigned
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: Windows Vista x64
PHP Version: 5.3.0
Assigned To: felipe
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2009-07-12 23:25:42] hm at mkjc dot net
Description:
------------
is_callable returns "true" for methods that are not present in the
parent class, but in the child class, even if you use the "parent"
keyword.
Earlier php versions correctly returned false, since the method is
missing in the parent class.
Perhaps it has something to do with the changes in conjunction with
late static binding.
Reproduce code:
---------------
<?php
class ParentClass {
}
class ChildClass extends ParentClass {
public function testIsCallable() {
var_dump(is_callable(array($this, 'parent::testIsCallable')));
}
}
$child = new ChildClass();
$child->testIsCallable();
?>
Expected result:
----------------
bool(false)
Actual result:
--------------
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48899&edit=1