diff options
-rw-r--r-- | Zend/zend_compile.c | 4 |
1 files changed, 4 insertions, 0 deletions
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; |