From c5f93d191e2bf5a9def069cf9701b5eb6e297a74 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 21 Sep 2020 12:37:44 +0200 Subject: Fix detection of code outside namespace Due to improvements to early binding, the opcode based check is no longer accurate. Reuse the syntactic check we're already using for declares instead. --- Zend/tests/function_outside_namespace.phpt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Zend/tests/function_outside_namespace.phpt (limited to 'Zend/tests/function_outside_namespace.phpt') diff --git a/Zend/tests/function_outside_namespace.phpt b/Zend/tests/function_outside_namespace.phpt new file mode 100644 index 0000000000..f63fb9f56a --- /dev/null +++ b/Zend/tests/function_outside_namespace.phpt @@ -0,0 +1,12 @@ +--TEST-- +Function declaration should not be allowed before namespace declaration +--FILE-- + +--EXPECTF-- +Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in %s on line %d -- cgit v1.2.1