|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54893 Namspace import doesn't work
Submitted: 2011-05-20 15:19 UTC Modified: 2011-05-20 16:36 UTC
From: marcel dot klehr at gmx dot de Assigned:
Status: Not a bug Package: *Compile Issues
PHP Version: 5.3.5 OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: marcel dot klehr at gmx dot de
New email:
PHP Version: OS:


 [2011-05-20 15:19 UTC] marcel dot klehr at gmx dot de
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:

Test script:
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 ...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-20 15:29 UTC] marcel dot klehr at gmx dot de
-PHP Version: 5.3SVN-2011-05-20 (SVN) +PHP Version: 5.3.5
 [2011-05-20 15:29 UTC] marcel dot klehr at gmx dot de
just altered the PHP version...
 [2011-05-20 15:56 UTC]
-Status: Open +Status: Bogus
 [2011-05-20 15:56 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Please re-read the import section. You might  need something like "use NamespaceOne\OutOfBoundsException;"
 [2011-05-20 16:36 UTC] marcel dot klehr at gmx dot de
I was under the impression that all items of that imported namespace are available unqualified in the new one. But now i see, you still have to qualify it with its imported name...
Shoulf have been pointed out more clearly in the docs!

Anyway, why don't you implement this. Importing all items of a particular namespace?!
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Jun 03 14:01:25 2020 UTC