@@ -3792,9 +3792,27 @@ static zend_always_inline zend_generator *zend_get_running_generator(EXECUTE_DAT
37923792}
37933793/* }}} */
37943794
3795+ /* TODO Can this be done using find_live_range? */
3796+ static bool is_in_silence_live_range (const zend_op_array op_array , uint32_t op_num ) {
3797+ for (int i = 0 ; i < op_array .last_live_range ; i ++ ) {
3798+ zend_live_range range = op_array .live_range [i ];
3799+ if (op_num >= range .start && op_num < range .end
3800+ && (range .var & ZEND_LIVE_MASK ) == ZEND_LIVE_SILENCE ) {
3801+ return true;
3802+ }
3803+ }
3804+ return false;
3805+ }
3806+
37953807static void cleanup_unfinished_calls (zend_execute_data * execute_data , uint32_t op_num ) /* {{{ */
37963808{
37973809 if (UNEXPECTED (EX (call ))) {
3810+ /* Do not cleanup unfinished calls for SILENCE live range as it might still get executed
3811+ * However, this can only happen if the exception is an instance of Exception
3812+ * (Error never gets suppressed) */
3813+ if (UNEXPECTED (is_in_silence_live_range (EX (func )-> op_array , op_num ))) {
3814+ return ;
3815+ }
37983816 zend_execute_data * call = EX (call );
37993817 zend_op * opline = EX (func )-> op_array .opcodes + op_num ;
38003818 int level ;
@@ -3937,18 +3955,6 @@ static const zend_live_range *find_live_range(const zend_op_array *op_array, uin
39373955}
39383956/* }}} */
39393957
3940- /* TODO Can this be done using find_live_range? */
3941- static bool is_in_silence_live_range (const zend_op_array op_array , uint32_t op_num ) {
3942- for (int i = 0 ; i < op_array .last_live_range ; i ++ ) {
3943- zend_live_range range = op_array .live_range [i ];
3944- if (op_num >= range .start && op_num < range .end
3945- && (range .var & ZEND_LIVE_MASK ) == ZEND_LIVE_SILENCE ) {
3946- return true;
3947- }
3948- }
3949- return false;
3950- }
3951-
39523958static void cleanup_live_vars (zend_execute_data * execute_data , uint32_t op_num , uint32_t catch_op_num ) /* {{{ */
39533959{
39543960 int i ;
0 commit comments