diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-21 12:37:44 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-21 12:37:44 +0200 |
commit | c5f93d191e2bf5a9def069cf9701b5eb6e297a74 (patch) | |
tree | 7d0f822aacc7344e492f7007e7aeb1386c908e57 /Zend/tests/function_outside_namespace.phpt | |
parent | ef9ab9159b409c6d3ea184b4ba88764d85c4133b (diff) | |
download | php-git-c5f93d191e2bf5a9def069cf9701b5eb6e297a74.tar.gz |
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.
Diffstat (limited to 'Zend/tests/function_outside_namespace.phpt')
-rw-r--r-- | Zend/tests/function_outside_namespace.phpt | 12 |
1 files changed, 12 insertions, 0 deletions
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-- +<?php + +function foo() {} + +namespace Bar; + +?> +--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 |