#48899 [NEW]: is_callable returns true even if method does not exist in parent class

From: Date: Sun, 12 Jul 2009 23:25:43 +0000
Subject: #48899 [NEW]: is_callable returns true even if method does not exist in parent class
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-139665@lists.php.net to get a copy of this message
From: hm at mkjc dot net Operating system: Windows Vista x64 PHP version: 5.3.0 PHP Bug Type: *General Issues Bug description: is_callable returns true even if method does not exist in parent class 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 bug report at http://bugs.php.net/?id=48899&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48899&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48899&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48899&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48899&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48899&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48899&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48899&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48899&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48899&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48899&r=support Expected behavior: http://bugs.php.net/fix.php?id=48899&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48899&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48899&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48899&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48899&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48899&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48899&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48899&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48899&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48899&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48899&r=mysqlcfg

« previous php.bugs (#139665) next »