php.net |  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
Votes:3
Avg. Score:3.7 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: nikic@php.net Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: * OS:
Private report: No CVE-ID: None
 [2011-10-09 17:27 UTC] nikic@php.net
Description:
------------
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:
---------------
<?php
namespace {
    use Exception;
}
namespace {
    use \Exception;
}

// http://codepad.viper-7.com/vN34cx

Expected result:
----------------
Two warnings.

Actual result:
--------------
One warning.

Patches

patch.txt (last revision 2011-10-11 09:04 UTC by nikic@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

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

Patch Name: patch.txt
Revision:   1318323848
URL:        https://bugs.php.net/patch-display.php?bug=60022&patch=patch.txt&revision=1318323848
 [2011-10-11 09:21 UTC] nikic@php.net
-Assigned To: +Assigned To: dmitry
 [2011-10-16 11:08 UTC] nikic@php.net
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] yohgaki@php.net
-PHP Version: 5.4.0beta1 +PHP Version: *
 [2014-07-15 11:12 UTC] yohgaki@php.net
This exists in all versions
http://3v4l.org/SCXWd
 [2015-04-06 20:10 UTC] nikic@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=cc70a46525f72340061107ced390eba3be1bf12a
Log: Fix bug #60022
 [2015-04-06 20:10 UTC] nikic@php.net
-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-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 08:01:29 2024 UTC