|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60022 "use statement [...] has no effect" depends on leading backslash
Submitted: 2011-10-09 17:27 UTC Modified: 2014-07-15 11:12 UTC
Avg. Score:3.7 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: * OS:
Private report: No CVE-ID: None
 [2011-10-09 17:27 UTC]
The "The use statement with non-compound name '%s' has no effect" warning is only thrown when the use statement doesn't have a leading backslash. It should be thrown in both cases as they are semantically equivalent.

(Patch is trivial: Get rid of the is_global arg altogether.)

Test script:
namespace {
    use Exception;
namespace {
    use \Exception;


Expected result:
Two warnings.

Actual result:
One warning.


patch.txt (last revision 2011-10-11 09:04 UTC by

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-11 09:04 UTC]
The following patch has been added/updated:

Patch Name: patch.txt
Revision:   1318323848
 [2011-10-11 09:21 UTC]
-Assigned To: +Assigned To: dmitry
 [2011-10-16 11:08 UTC]
Only thing this could "break" is that the "You seem to be trying to use a different language..." message would be triggered for "use \strict;" too. If that's a problem I can modify the patch to not throw in that case.
 [2014-07-15 11:12 UTC]
-PHP Version: 5.4.0beta1 +PHP Version: *
 [2014-07-15 11:12 UTC]
This exists in all versions
 [2015-04-06 20:10 UTC]
Automatic comment on behalf of nikic
Log: Fix bug #60022
 [2015-04-06 20:10 UTC]
-Status: Assigned +Status: Closed
 [2016-03-18 08:46 UTC] david dot macek dot 0 at gmail dot com
Just wanted to say this patch broke one of our systems. I would argue that such changes belong into a minor release rather than a patch release.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Dec 06 02:01:27 2023 UTC