Bug #52933 [NEW]: is_callable() return always TRUE if __call() is defined
| From: | jackovson at gmail dot com | Date: | Mon, 27 Sep 2010 09:47:55 +0000 |
| Subject: | Bug #52933 [NEW]: is_callable() return always TRUE if __call() is defined | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-154670@lists.php.net to get a copy of this message | ||
From:
Operating system: linux
PHP version: 5.3.3
Package: Class/Object related
Bug Type: Bug
Bug description:is_callable() return always TRUE if __call() is defined
Description:
------------
As said in the link below, is_callable() will always return TRUE if _call()
is
defined.
Maybe it should simply not, or maybe whe should have another magic method
like :
__methodexist($name), that return TRUE if a method could be called by
__call().
http://www.php.net/manual/fr/function.is-callable.php#49879
Test script:
---------------
<?php
class TestMe {
public function __call($name, $args) {
}
public function bug($function) {
return is_callable(array($this, $function));
}
public function iExist() {
}
}
$test = new TestMe();
var_dump($test->bug('iExist'));
var_dump($test->bug('iDont'));
Expected result:
----------------
bool(true)
bool(false)
Actual result:
--------------
bool(true)
bool(true)
--
Edit bug report at http://bugs.php.net/bug.php?id=52933&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52933&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52933&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52933&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52933&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52933&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52933&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52933&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52933&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52933&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52933&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52933&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52933&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52933&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52933&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52933&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52933&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52933&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52933&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52933&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52933&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52933&r=mysqlcfg