@@ -2166,14 +2166,6 @@ static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint
2166
2166
znode name_node ;
2167
2167
zend_op * opline ;
2168
2168
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
-
2177
2169
zend_compile_expr (& name_node , name_ast );
2178
2170
if (name_node .op_type == IS_CONST ) {
2179
2171
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
2185
2177
opline = zend_emit_op (result , ZEND_FETCH_R , & name_node , NULL );
2186
2178
}
2187
2179
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 );
2192
2192
}
2193
2193
}
2194
2194
0 commit comments