]> granicus.if.org Git - php/commitdiff
Fix bug #60022
authorNikita Popov <nikic@php.net>
Mon, 6 Apr 2015 20:03:04 +0000 (22:03 +0200)
committerNikita Popov <nikic@php.net>
Mon, 6 Apr 2015 20:03:04 +0000 (22:03 +0200)
NEWS
Zend/tests/ns_033.phpt
Zend/zend_compile.c
Zend/zend_compile.h
Zend/zend_language_parser.y

diff --git a/NEWS b/NEWS
index 3e5dcce12b7aeba0aab419cabf640aa954b8ae6f..53b8776e72e0f5ab13b314d14eb0b27f73c103f9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP                                                                        NEWS
 ?? ??? 2015, PHP 5.5.25
 
 - Core:
+  . Fixed bug #60022 ("use statement [...] has no effect" depends on leading
+    backslash). (Nikita)
   . Fixed bug #68652 (segmentation fault in destructor). (Dmitry)
 
 - cURL:
index dc431d82b9b324f20c461eb9468df482f47480dc..ba40683002fe2e7fc31bc877bc09ad4aff55c601 100644 (file)
@@ -3,6 +3,8 @@
 --FILE--
 <?php
 use A;
+use \B;
 --EXPECTF--
 Warning: The use statement with non-compound name 'A' has no effect in %sns_033.php on line 2
 
+Warning: The use statement with non-compound name 'B' has no effect in %sns_033.php on line 3
index 04f17ba573c3d917b7e992b169b96cae5e122067..94566a5d59d3ad4950421079b6f43dba9da9e392 100644 (file)
@@ -7014,7 +7014,7 @@ void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC
 }
 /* }}} */
 
-void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */
+void zend_do_use(znode *ns_name, znode *new_name TSRMLS_DC) /* {{{ */
 {
        char *lcname;
        zval *name, *ns, tmp;
@@ -7042,7 +7042,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{
                } else {
                        *name = *ns;
                        zval_copy_ctor(name);
-                       warn = !is_global && !CG(current_namespace);
+                       warn = !CG(current_namespace);
                }
        }
 
index 08c11a7d015038ff29d888f2a2e6b32a527bbcfe..2d8833400b6e202db6939ac2bdfa772a5de460a5 100644 (file)
@@ -635,7 +635,7 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM
 void zend_do_begin_namespace(const znode *name, zend_bool with_brackets TSRMLS_DC);
 void zend_do_end_namespace(TSRMLS_D);
 void zend_verify_namespace(TSRMLS_D);
-void zend_do_use(znode *name, znode *new_name, int is_global TSRMLS_DC);
+void zend_do_use(znode *name, znode *new_name TSRMLS_DC);
 void zend_do_end_compilation(TSRMLS_D);
 
 void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static TSRMLS_DC);
index 6d8c355fda970e6b5b2a90a7812af0d16c43396f..2926c8c715244e62bfadf7c60720fc173a8f85ad 100644 (file)
@@ -249,10 +249,10 @@ use_declarations:
 ;
 
 use_declaration:
-               namespace_name                  { zend_do_use(&$1, NULL, 0 TSRMLS_CC); }
-       |       namespace_name T_AS T_STRING    { zend_do_use(&$1, &$3, 0 TSRMLS_CC); }
-       |       T_NS_SEPARATOR namespace_name { zend_do_use(&$2, NULL, 1 TSRMLS_CC); }
-       |       T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use(&$2, &$4, 1 TSRMLS_CC); }
+               namespace_name                  { zend_do_use(&$1, NULL TSRMLS_CC); }
+       |       namespace_name T_AS T_STRING    { zend_do_use(&$1, &$3 TSRMLS_CC); }
+       |       T_NS_SEPARATOR namespace_name { zend_do_use(&$2, NULL TSRMLS_CC); }
+       |       T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use(&$2, &$4 TSRMLS_CC); }
 ;
 
 constant_declaration: