diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-05-27 17:11:44 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-05-27 17:12:20 +0200 |
commit | fd23f9104a9772234a3469e341500cf1b9503f63 (patch) | |
tree | 6d6853d402a1937e63f6077d3c603a482261e98f /Zend/zend_compile.c | |
parent | 070f877b7641d3242431da5256d714dd661e6d2f (diff) | |
download | php-git-fd23f9104a9772234a3469e341500cf1b9503f63.tar.gz |
BIND_STATIC of implicit binding may be undef
Even though we don't need it at runtime, add the BIND_IMPLICIT
flag to BIND_STATIC as well, so we can distinguish this case in
type inference.
This fixes a JIT miscompile in arrow_functions/002.phpt.
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r-- | Zend/zend_compile.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d0d5c7af19..b4d4012d7f 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4012,7 +4012,7 @@ void zend_compile_global_var(zend_ast *ast) /* {{{ */ } /* }}} */ -static void zend_compile_static_var_common(zend_string *var_name, zval *value, uint32_t by_ref) /* {{{ */ +static void zend_compile_static_var_common(zend_string *var_name, zval *value, uint32_t mode) /* {{{ */ { zend_op *opline; if (!CG(active_op_array)->static_variables) { @@ -4031,7 +4031,7 @@ static void zend_compile_static_var_common(zend_string *var_name, zval *value, u opline = zend_emit_op(NULL, ZEND_BIND_STATIC, NULL, NULL); opline->op1_type = IS_CV; opline->op1.var = lookup_cv(var_name); - opline->extended_value = (uint32_t)((char*)value - (char*)CG(active_op_array)->static_variables->arData) | by_ref; + opline->extended_value = (uint32_t)((char*)value - (char*)CG(active_op_array)->static_variables->arData) | mode; } /* }}} */ @@ -5584,7 +5584,7 @@ static void zend_compile_closure_uses(zend_ast *ast) /* {{{ */ } } - zend_compile_static_var_common(var_name, &zv, var_ast->attr); + zend_compile_static_var_common(var_name, &zv, var_ast->attr ? ZEND_BIND_REF : 0); } } /* }}} */ @@ -5595,7 +5595,7 @@ static void zend_compile_implicit_closure_uses(closure_info *info) ZEND_HASH_FOREACH_STR_KEY(&info->uses, var_name) zval zv; ZVAL_NULL(&zv); - zend_compile_static_var_common(var_name, &zv, 0); + zend_compile_static_var_common(var_name, &zv, ZEND_BIND_IMPLICIT); ZEND_HASH_FOREACH_END(); } |