@@ -2164,14 +2164,6 @@ static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint
2164
2164
znode name_node ;
2165
2165
zend_op * opline ;
2166
2166
2167
- /* there is a chance someone is accessing $this */
2168
- if (ast -> kind != ZEND_AST_ZVAL
2169
- && CG (active_op_array )-> scope && CG (active_op_array )-> this_var == (uint32_t )-1
2170
- ) {
2171
- zend_string * key = zend_string_init ("this" , sizeof ("this" ) - 1 , 0 );
2172
- CG (active_op_array )-> this_var = lookup_cv (CG (active_op_array ), key );
2173
- }
2174
-
2175
2167
zend_compile_expr (& name_node , name_ast );
2176
2168
if (name_node .op_type == IS_CONST ) {
2177
2169
convert_to_string (& name_node .u .constant );
@@ -2183,10 +2175,18 @@ static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint
2183
2175
opline = zend_emit_op (result , ZEND_FETCH_R , & name_node , NULL );
2184
2176
}
2185
2177
2186
- opline -> extended_value = ZEND_FETCH_LOCAL ;
2187
- if (name_node .op_type == IS_CONST ) {
2188
- if (zend_is_auto_global (Z_STR (name_node .u .constant ))) {
2189
- opline -> extended_value = ZEND_FETCH_GLOBAL ;
2178
+ if (name_node .op_type == IS_CONST &&
2179
+ zend_is_auto_global (Z_STR (name_node .u .constant ))) {
2180
+
2181
+ opline -> extended_value = ZEND_FETCH_GLOBAL ;
2182
+ } else {
2183
+ opline -> extended_value = ZEND_FETCH_LOCAL ;
2184
+ /* there is a chance someone is accessing $this */
2185
+ if (ast -> kind != ZEND_AST_ZVAL
2186
+ && CG (active_op_array )-> scope && CG (active_op_array )-> this_var == (uint32_t )-1
2187
+ ) {
2188
+ zend_string * key = zend_string_init ("this" , sizeof ("this" ) - 1 , 0 );
2189
+ CG (active_op_array )-> this_var = lookup_cv (CG (active_op_array ), key );
2190
2190
}
2191
2191
}
2192
2192
0 commit comments