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

 ID:                 54893
 Updated by:         johan...@php.net
 Reported by:        marcel dot klehr at gmx dot de
 Summary:            Namspace import doesn't work
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            *Compile Issues
 Operating System:   Windows 7
 PHP Version:        5.3.5
 Block user comment: N
 Private report:     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

Please re-read the import section. You might  need something like "use
NamespaceOne\OutOfBoundsException;"


Previous Comments:
------------------------------------------------------------------------
[2011-05-20 15:29:37] marcel dot klehr at gmx dot de

just altered the PHP version...

------------------------------------------------------------------------
[2011-05-20 15:19:55] marcel dot klehr at gmx dot de

Description:
------------
I'm running XAMPP on Win7 with PHP 5.3.5 (don't know whether I got that
one above selected right...)



I tried importing a namespace and instantiating a class in there in
another namespace, but it seemed not to have worked.



---

>From manual page: http://www.php.net/language.namespaces.importing

---



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

namespace NamespaceOne

{

        class OutOfBoundsException extends \OutOfBoundsException

        {

        

        }

}

namespace NamespaceTwo

{

        use NamespaceOne;



        throw new OutOfBoundsException;

}

?>

Expected result:
----------------
Fatal error: Uncaught exception 'NamespaceOne\OutOfBoundsException' 

Actual result:
--------------
Fatal error: Class 'NamespaceTwo\OutOfBoundsException' not found in ...


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



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

Reply via email to