diff options
author | Nikita Popov <nikic@php.net> | 2015-12-29 11:20:44 +0100 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2015-12-29 11:20:44 +0100 |
commit | 4440436821404ff3c76682726e63d1aaf381f73a (patch) | |
tree | f844b8684d654eea505809d27e6fc2c8b6c1dda7 | |
parent | cb1db49d0a071a9ae89c930ee7efa4a68b742972 (diff) | |
download | php-git-4440436821404ff3c76682726e63d1aaf381f73a.tar.gz |
Forbid use() of auto-globals
We don't correctly support it, it doesn't make sense and it's also
forbidden for parameters.
-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; |