@@ -2258,9 +2258,11 @@ static zend_op *zend_delayed_compile_end(uint32_t offset) /* {{{ */
2258
2258
2259
2259
ZEND_ASSERT (count >= offset );
2260
2260
for (i = offset ; i < count ; ++ i ) {
2261
- if (oplines [i ].opcode != ZEND_NOP ) {
2261
+ if (EXPECTED ( oplines [i ].opcode != ZEND_NOP ) ) {
2262
2262
opline = get_next_op ();
2263
2263
memcpy (opline , & oplines [i ], sizeof (zend_op ));
2264
+ } else {
2265
+ opline = CG (active_op_array )-> opcodes + oplines [i ].extended_value ;
2264
2266
}
2265
2267
}
2266
2268
@@ -2888,15 +2890,28 @@ static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t
2888
2890
opline = zend_delayed_compile_var (& obj_node , obj_ast , type , 0 );
2889
2891
zend_separate_if_call_and_write (& obj_node , obj_ast , type );
2890
2892
if (nullsafe ) {
2891
- /* Flush delayed oplines */
2892
- zend_op * opline = NULL , * oplines = zend_stack_base (& CG (delayed_oplines_stack ));
2893
- uint32_t i , count = zend_stack_count (& CG (delayed_oplines_stack ));
2894
-
2895
- for (i = 0 ; i < count ; ++ i ) {
2896
- if (oplines [i ].opcode != ZEND_NOP ) {
2897
- opline = get_next_op ();
2898
- memcpy (opline , & oplines [i ], sizeof (zend_op ));
2899
- oplines [i ].opcode = ZEND_NOP ;
2893
+ if (obj_node .op_type == IS_TMP_VAR ) {
2894
+ /* Flush delayed oplines */
2895
+ zend_op * opline = NULL , * oplines = zend_stack_base (& CG (delayed_oplines_stack ));
2896
+ uint32_t var = obj_node .u .op .var ;
2897
+ uint32_t count = zend_stack_count (& CG (delayed_oplines_stack ));
2898
+ uint32_t i = count ;
2899
+
2900
+ while (i > 0 && oplines [i - 1 ].result_type == IS_TMP_VAR && oplines [i - 1 ].result .var == var ) {
2901
+ i -- ;
2902
+ if (oplines [i ].op1_type == IS_TMP_VAR ) {
2903
+ var = oplines [i ].op1 .var ;
2904
+ } else {
2905
+ break ;
2906
+ }
2907
+ }
2908
+ for (; i < count ; ++ i ) {
2909
+ if (oplines [i ].opcode != ZEND_NOP ) {
2910
+ opline = get_next_op ();
2911
+ memcpy (opline , & oplines [i ], sizeof (zend_op ));
2912
+ oplines [i ].opcode = ZEND_NOP ;
2913
+ oplines [i ].extended_value = opline - CG (active_op_array )-> opcodes ;
2914
+ }
2900
2915
}
2901
2916
}
2902
2917
zend_emit_jmp_null (& obj_node );
0 commit comments