|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46979 use with non-compound name *has* effect
Submitted: 2008-12-30 23:38 UTC Modified: 2009-01-14 13:58 UTC
From: ladislav at marek dot su Assigned: dmitry
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.0alpha3 OS: *
Private report: No CVE-ID:
 [2008-12-30 23:38 UTC] ladislav at marek dot su
Currently php throws bogus warning with non-compound name in use statement.

Reproduce code:
namespace My;

use Foo;

new Foo\Bar;

Expected result:
Fatal error: Class 'Foo\Bar' not found in ...

Actual result:
Warning: The use statement with non-compound name 'Foo' has no effect in ...

Fatal error: Class 'Foo\Bar' not found in ...

'use Foo' has effect, because fully qualified name isn't My\Foo\Bar but Foo\Bar.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-30 23:49 UTC]
Duplicated of Bug #46755
 [2008-12-31 09:36 UTC] ladislav at marek dot su
Yes, but bug isn't fixed, 'use ArrayObject' is same as 'use \ArrayObject' manual is wrong. Please consider importing non-compound class or namespace names without \ prefix (remove invalid warning).
 [2009-01-01 02:52 UTC]
assign to namespace maintainer
 [2009-01-14 13:58 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 10:01:54 2015 UTC