@@ -2179,9 +2179,11 @@ static zend_op *zend_delayed_compile_end(uint32_t offset) /* {{{ */
2179
2179
2180
2180
ZEND_ASSERT (count >= offset );
2181
2181
for (i = offset ; i < count ; ++ i ) {
2182
- if (oplines [i ].opcode != ZEND_NOP ) {
2182
+ if (EXPECTED ( oplines [i ].opcode != ZEND_NOP ) ) {
2183
2183
opline = get_next_op ();
2184
2184
memcpy (opline , & oplines [i ], sizeof (zend_op ));
2185
+ } else {
2186
+ opline = CG (active_op_array )-> opcodes + oplines [i ].extended_value ;
2185
2187
}
2186
2188
}
2187
2189
@@ -2825,15 +2827,28 @@ static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t
2825
2827
2826
2828
zend_separate_if_call_and_write (& obj_node , obj_ast , type );
2827
2829
if (nullsafe ) {
2828
- /* Flush delayed oplines */
2829
- zend_op * opline = NULL , * oplines = zend_stack_base (& CG (delayed_oplines_stack ));
2830
- uint32_t i , count = zend_stack_count (& CG (delayed_oplines_stack ));
2831
-
2832
- for (i = 0 ; i < count ; ++ i ) {
2833
- if (oplines [i ].opcode != ZEND_NOP ) {
2834
- opline = get_next_op ();
2835
- memcpy (opline , & oplines [i ], sizeof (zend_op ));
2836
- oplines [i ].opcode = ZEND_NOP ;
2830
+ if (obj_node .op_type == IS_TMP_VAR ) {
2831
+ /* Flush delayed oplines */
2832
+ zend_op * opline = NULL , * oplines = zend_stack_base (& CG (delayed_oplines_stack ));
2833
+ uint32_t var = obj_node .u .op .var ;
2834
+ uint32_t count = zend_stack_count (& CG (delayed_oplines_stack ));
2835
+ uint32_t i = count ;
2836
+
2837
+ while (i > 0 && oplines [i - 1 ].result_type == IS_TMP_VAR && oplines [i - 1 ].result .var == var ) {
2838
+ i -- ;
2839
+ if (oplines [i ].op1_type == IS_TMP_VAR ) {
2840
+ var = oplines [i ].op1 .var ;
2841
+ } else {
2842
+ break ;
2843
+ }
2844
+ }
2845
+ for (; i < count ; ++ i ) {
2846
+ if (oplines [i ].opcode != ZEND_NOP ) {
2847
+ opline = get_next_op ();
2848
+ memcpy (opline , & oplines [i ], sizeof (zend_op ));
2849
+ oplines [i ].opcode = ZEND_NOP ;
2850
+ oplines [i ].extended_value = opline - CG (active_op_array )-> opcodes ;
2851
+ }
2837
2852
}
2838
2853
}
2839
2854
zend_emit_jmp_null (& obj_node );
0 commit comments