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

 ID:                 52574
 Updated by:         johan...@php.net
 Reported by:        flyingmana at googlemail dot com
 Summary:            function in namespace - call from string
-Status:             Open
+Status:             Bogus
 Type:               Feature/Change Request
 Package:            *General Issues
 Operating System:   Ubuntu
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[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

Reply via email to