Bug #54171 [NEW]: is_callable() returns false on callable functions when not specifying namespace
| From: | hellosexyprout at gmail dot com | Date: | Sat, 05 Mar 2011 20:00:08 +0000 |
| Subject: | Bug #54171 [NEW]: is_callable() returns false on callable functions when not specifying namespace | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-159249@lists.php.net to get a copy of this message | ||
From:
Operating system: Ubuntu 10.10
PHP version: 5.3.5
Package: *General Issues
Bug Type: Bug
Bug description:is_callable() returns false on callable functions when not specifying namespace
Description:
------------
First sorry, I can only test this case with PHP 5.3.3 but I
didn't find any bugs referring to is_callable() since then, so I
think it's worth reporting.
The problem is that is_callable() will return false if you don't
specify the eventual namespace you're using.
Test script:
---------------
<?php
namespace Foo;
function bar() {
return 'bar!';
}
var_dump(is_callable('bar'));
var_dump(is_callable('\Foo\bar'));
var_dump(bar());
var_dump(\Foo\bar());
Expected result:
----------------
bool(false)
bool(true)
string(4) "bar!"
string(4) "bar!"
Actual result:
--------------
bool(true)
bool(true)
string(4) "bar!"
string(4) "bar!"
--
Edit bug report at http://bugs.php.net/bug.php?id=54171&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54171&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54171&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54171&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54171&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54171&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54171&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54171&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54171&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54171&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54171&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54171&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54171&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54171&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54171&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54171&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54171&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54171&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54171&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54171&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54171&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54171&r=mysqlcfg