From 926f1007eaca520cb703618bca77cccd54deb4e7 Mon Sep 17 00:00:00 2001 From: Giovanni Giacobbi Date: Wed, 13 Dec 2023 10:37:17 +0100 Subject: [PATCH] Remove warning "use statement with non-compound name '...' has no effect" This message was in fact not true, as the statement indeed *has* an effect, that is fixing the case for a potential autoloading invocation, as in: use Alpha; new alpha(); // will issue autoload for "Alpha" instead of "alpha" This is very relevant for case-sensitive file systems that load classes using their name as file name. --- Zend/tests/bug69388.phpt | 1 - Zend/tests/bug69388_2.phpt | 1 - Zend/tests/ns_033.phpt | 3 --- Zend/zend_compile.c | 5 ----- 4 files changed, 10 deletions(-) diff --git a/Zend/tests/bug69388.phpt b/Zend/tests/bug69388.phpt index c874db715dea2..6f4e083e2838c 100644 --- a/Zend/tests/bug69388.phpt +++ b/Zend/tests/bug69388.phpt @@ -15,4 +15,3 @@ eval('namespace {use Exception;}'); ?> --EXPECT-- -The use statement with non-compound name 'Exception' has no effect diff --git a/Zend/tests/bug69388_2.phpt b/Zend/tests/bug69388_2.phpt index 40b14e02577f7..485fdb987832f 100644 --- a/Zend/tests/bug69388_2.phpt +++ b/Zend/tests/bug69388_2.phpt @@ -12,4 +12,3 @@ eval('namespace {use Exception;}'); ?> --EXPECT-- -The use statement with non-compound name 'Exception' has no effect diff --git a/Zend/tests/ns_033.phpt b/Zend/tests/ns_033.phpt index 39bcf80916608..3755c9ca3cf30 100644 --- a/Zend/tests/ns_033.phpt +++ b/Zend/tests/ns_033.phpt @@ -6,6 +6,3 @@ 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 1078dd1d20a2a..4aaa14dab94c8 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -8377,11 +8377,6 @@ static void zend_compile_use(zend_ast *ast) /* {{{ */ new_name = zend_string_init(unqualified_name, unqualified_name_len, 0); } else { new_name = zend_string_copy(old_name); - - if (!current_ns) { - zend_error(E_WARNING, "The use statement with non-compound name '%s' " - "has no effect", ZSTR_VAL(new_name)); - } } }