@@ -3883,9 +3883,27 @@ static zend_always_inline zend_generator *zend_get_running_generator(EXECUTE_DAT
38833883}
38843884/* }}} */
38853885
3886+ /* TODO Can this be done using find_live_range? */
3887+ static bool is_in_silence_live_range (const zend_op_array op_array , uint32_t op_num ) {
3888+ for (int i = 0 ; i < op_array .last_live_range ; i ++ ) {
3889+ zend_live_range range = op_array .live_range [i ];
3890+ if (op_num >= range .start && op_num < range .end
3891+ && (range .var & ZEND_LIVE_MASK ) == ZEND_LIVE_SILENCE ) {
3892+ return true;
3893+ }
3894+ }
3895+ return false;
3896+ }
3897+
38863898static void cleanup_unfinished_calls (zend_execute_data * execute_data , uint32_t op_num ) /* {{{ */
38873899{
38883900 if (UNEXPECTED (EX (call ))) {
3901+ /* Do not cleanup unfinished calls for SILENCE live range as it might still get executed
3902+ * However, this can only happen if the exception is an instance of Exception
3903+ * (Error never gets suppressed) */
3904+ if (UNEXPECTED (is_in_silence_live_range (EX (func )-> op_array , op_num ))) {
3905+ return ;
3906+ }
38893907 zend_execute_data * call = EX (call );
38903908 zend_op * opline = EX (func )-> op_array .opcodes + op_num ;
38913909 int level ;
@@ -4028,18 +4046,6 @@ static const zend_live_range *find_live_range(const zend_op_array *op_array, uin
40284046}
40294047/* }}} */
40304048
4031- /* TODO Can this be done using find_live_range? */
4032- static bool is_in_silence_live_range (const zend_op_array op_array , uint32_t op_num ) {
4033- for (int i = 0 ; i < op_array .last_live_range ; i ++ ) {
4034- zend_live_range range = op_array .live_range [i ];
4035- if (op_num >= range .start && op_num < range .end
4036- && (range .var & ZEND_LIVE_MASK ) == ZEND_LIVE_SILENCE ) {
4037- return true;
4038- }
4039- }
4040- return false;
4041- }
4042-
40434049static void cleanup_live_vars (zend_execute_data * execute_data , uint32_t op_num , uint32_t catch_op_num ) /* {{{ */
40444050{
40454051 int i ;
0 commit comments