From 4440436821404ff3c76682726e63d1aaf381f73a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 29 Dec 2015 11:20:44 +0100 Subject: Forbid use() of auto-globals We don't correctly support it, it doesn't make sense and it's also forbidden for parameters. --- Zend/zend_compile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 97be4b966e..3a7e0b552c 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4908,6 +4908,10 @@ void zend_compile_closure_uses(zend_ast *ast) /* {{{ */ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as lexical variable"); } + if (zend_is_auto_global(name)) { + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use auto-global as lexical variable"); + } + ZVAL_NULL(&zv); Z_CONST_FLAGS(zv) = by_ref ? IS_LEXICAL_REF : IS_LEXICAL_VAR; -- cgit v1.2.1