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

 ID:                 65244
 Updated by:         ni...@php.net
 Reported by:        strategycon at yahoo dot com
 Summary:            function_exist() returns false when using imported
                     namespace alias
-Status:             Open
+Status:             Wont fix
 Type:               Feature/Change Request
 Package:            Reflection related
 Operating System:   Ubuntu
 PHP Version:        5.3Git-2013-07-11 (snap)
 Block user comment: N
 Private report:     N

 New Comment:

Function names, class names and generally all names passed as strings are 
always fully qualified. For classes PHP 5.5 added the ::class syntax to easily 
get the FQCN from an alias.


Previous Comments:
------------------------------------------------------------------------
[2013-07-12 12:30:03] a...@php.net

Compile vs. execution phase is that.

------------------------------------------------------------------------
[2013-07-11 15:47:36] strategycon at yahoo dot com

Description:
------------
namespace mynamespace;

use Symfony\Component\Validator\Constraints as Assert;

class myClass
{
    function classExists($name == 'NotBlank')
    {
        return function_exists('Assert\\' . $name)
    }

    function classExistsExt($name == 'NotBlank')
    {
        return function_exists('Symfony\Component\Validator\Constraints\\' . 
$name)
    }
}

myClass::classExists()
// returns false

myClass::classExists()
// returns true



Expected result:
----------------
To fully benefit from namespace importing and "aliasing", I would expect that 
method to return true when namespace alias is used instead of full/original one.



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65244&edit=1

Reply via email to