Edit report at http://bugs.php.net/bug.php?id=54171&edit=1

 ID:                 54171
 User updated by:    hellosexyprout at gmail dot com
 Reported by:        hellosexyprout at gmail dot com
 Summary:            is_callable() returns false on callable functions
                     when not specifying namespace
 Status:             Open
 Type:               Bug
 Package:            *General Issues
 Operating System:   Ubuntu 10.10
 PHP Version:        5.3.5
 Block user comment: N
 Private report:     N

 New Comment:

PLEASE NOTE: I inverted the actual and expected results, sorry.


Previous Comments:
------------------------------------------------------------------------
[2011-03-05 21:00:08] hellosexyprout at gmail dot com

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 this bug report at http://bugs.php.net/bug.php?id=54171&edit=1

Reply via email to