Skip to content

Commit 306a0f2

Browse files
committed
Merge branch 'master' of https://github.com/php/php-src
2 parents 21ccdf6 + 03f41f9 commit 306a0f2

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Zend/zend_compile.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,14 +2166,6 @@ static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint
21662166
znode name_node;
21672167
zend_op *opline;
21682168

2169-
/* there is a chance someone is accessing $this */
2170-
if (ast->kind != ZEND_AST_ZVAL
2171-
&& CG(active_op_array)->scope && CG(active_op_array)->this_var == (uint32_t)-1
2172-
) {
2173-
zend_string *key = zend_string_init("this", sizeof("this") - 1, 0);
2174-
CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), key);
2175-
}
2176-
21772169
zend_compile_expr(&name_node, name_ast);
21782170
if (name_node.op_type == IS_CONST) {
21792171
convert_to_string(&name_node.u.constant);
@@ -2185,10 +2177,18 @@ static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint
21852177
opline = zend_emit_op(result, ZEND_FETCH_R, &name_node, NULL);
21862178
}
21872179

2188-
opline->extended_value = ZEND_FETCH_LOCAL;
2189-
if (name_node.op_type == IS_CONST) {
2190-
if (zend_is_auto_global(Z_STR(name_node.u.constant))) {
2191-
opline->extended_value = ZEND_FETCH_GLOBAL;
2180+
if (name_node.op_type == IS_CONST &&
2181+
zend_is_auto_global(Z_STR(name_node.u.constant))) {
2182+
2183+
opline->extended_value = ZEND_FETCH_GLOBAL;
2184+
} else {
2185+
opline->extended_value = ZEND_FETCH_LOCAL;
2186+
/* there is a chance someone is accessing $this */
2187+
if (ast->kind != ZEND_AST_ZVAL
2188+
&& CG(active_op_array)->scope && CG(active_op_array)->this_var == (uint32_t)-1
2189+
) {
2190+
zend_string *key = zend_string_init("this", sizeof("this") - 1, 0);
2191+
CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), key);
21922192
}
21932193
}
21942194

0 commit comments

Comments
 (0)