Edit report at http://bugs.php.net/bug.php?id=52574&edit=1
ID: 52574 Comment by: flyingmana at googlemail dot com Reported by: flyingmana at googlemail dot com Summary: function in namespace - call from string Status: Bogus Type: Feature/Change Request Package: *General Issues Operating System: Ubuntu PHP Version: 5.3.3 Block user comment: N New Comment: Sorry, have looked multiple times to the manual and havent find where this was described for functions. But back to the problem, i see the call from a string does work. But if you use an namespace alias, like in my example, it does not work anymore. Is this real not a bug? Previous Comments: ------------------------------------------------------------------------ [2010-08-10 12:11:31] johan...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php http://php.net/manual/en/language.namespaces.dynamic.php ------------------------------------------------------------------------ [2010-08-10 11:51:24] flyingmana at googlemail dot com 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 this bug report at http://bugs.php.net/bug.php?id=52574&edit=1