From:             
Operating system: Ubuntu
PHP version:      5.3.3
Package:          *General Issues
Bug Type:         Feature/Change Request
Bug description:function in namespace - call from string

Description:
------------
in a script without namespaces you could took the function name in a string
und call it via $string()



this does not work, if this function is located in a namespace.





The analog case with classes is described as ok in the docs(dont have
tested it), so it should also work with functions.

So i Request to add this feature.

Test script:
---------------
<?php



namespace bar{



        function foo(){

                echo "test", "\n";

        }



        function foo2(){

                echo "test2", "\n";

        }

        function foo3(){

                echo "test3", "\n";

        }

}



namespace{

        echo "start \n";

        \bar\foo();

        use \bar as haha;

        haha\foo2();

        $test = 'haha\foo3';

        $test();

}





?>

Expected result:
----------------
test

test2

test3

Actual result:
--------------
test

test2



Fatal error: Call to undefined function haha\foo3() in
/home/flyingmana/Desktop/sandkasten/namespace.php on line 19



-- 
Edit bug report at http://bugs.php.net/bug.php?id=52574&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52574&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52574&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52574&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52574&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52574&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52574&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52574&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52574&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52574&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52574&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52574&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52574&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52574&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52574&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52574&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52574&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52574&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52574&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52574&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52574&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52574&r=mysqlcfg

Reply via email to