summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2015-04-06 22:03:04 +0200
committerNikita Popov <nikic@php.net>2015-04-06 22:03:04 +0200
commitcc70a46525f72340061107ced390eba3be1bf12a (patch)
tree2d03fe4083e04e283d38b17722e13cd82048539f
parent160dbe91a9e2767156c11f90a7c73eaae7f52e12 (diff)
downloadphp-git-cc70a46525f72340061107ced390eba3be1bf12a.tar.gz
Fix bug #60022
-rw-r--r--NEWS2
-rw-r--r--Zend/tests/ns_033.phpt2
-rw-r--r--Zend/zend_compile.c4
-rw-r--r--Zend/zend_compile.h2
-rw-r--r--Zend/zend_language_parser.y8
5 files changed, 11 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 3e5dcce12b..53b8776e72 100644
--- 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:
diff --git a/Zend/tests/ns_033.phpt b/Zend/tests/ns_033.phpt
index dc431d82b9..ba40683002 100644
--- a/Zend/tests/ns_033.phpt
+++ b/Zend/tests/ns_033.phpt
@@ -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
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 04f17ba573..94566a5d59 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -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);
}
}
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 08c11a7d01..2d8833400b 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -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);
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index 6d8c355fda..2926c8c715 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -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: