From f4d46daade3475f27471176755658eb57b44ed9e Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Wed, 22 Jun 2022 09:34:23 +0100 Subject: [PATCH] Don't shortcut empty oparray executions if zend_execute_ex has been overridden --- Zend/zend_vm_def.h | 3 ++- Zend/zend_vm_execute.h | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 54cc5dfe3a923..9043cde725bac 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -6281,7 +6281,8 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMPVAR|CV, ANY, EVAL, SPEC(OBSER } } else if (new_op_array->last == 1 && new_op_array->opcodes[0].opcode == ZEND_RETURN - && new_op_array->opcodes[0].op1_type == IS_CONST) { + && new_op_array->opcodes[0].op1_type == IS_CONST + && EXPECTED(zend_execute_ex == execute_ex)) { if (RETURN_VALUE_USED(opline)) { const zend_op *op = new_op_array->opcodes; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 76e4aace61471..39005c9184946 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -4843,7 +4843,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HAN } } else if (new_op_array->last == 1 && new_op_array->opcodes[0].opcode == ZEND_RETURN - && new_op_array->opcodes[0].op1_type == IS_CONST) { + && new_op_array->opcodes[0].op1_type == IS_CONST + && EXPECTED(zend_execute_ex == execute_ex)) { if (RETURN_VALUE_USED(opline)) { const zend_op *op = new_op_array->opcodes; @@ -4925,7 +4926,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_OBSERVER_ } } else if (new_op_array->last == 1 && new_op_array->opcodes[0].opcode == ZEND_RETURN - && new_op_array->opcodes[0].op1_type == IS_CONST) { + && new_op_array->opcodes[0].op1_type == IS_CONST + && EXPECTED(zend_execute_ex == execute_ex)) { if (RETURN_VALUE_USED(opline)) { const zend_op *op = new_op_array->opcodes; @@ -14445,7 +14447,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMPVAR_HA } } else if (new_op_array->last == 1 && new_op_array->opcodes[0].opcode == ZEND_RETURN - && new_op_array->opcodes[0].op1_type == IS_CONST) { + && new_op_array->opcodes[0].op1_type == IS_CONST + && EXPECTED(zend_execute_ex == execute_ex)) { if (RETURN_VALUE_USED(opline)) { const zend_op *op = new_op_array->opcodes; @@ -38830,7 +38833,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLE } } else if (new_op_array->last == 1 && new_op_array->opcodes[0].opcode == ZEND_RETURN - && new_op_array->opcodes[0].op1_type == IS_CONST) { + && new_op_array->opcodes[0].op1_type == IS_CONST + && EXPECTED(zend_execute_ex == execute_ex)) { if (RETURN_VALUE_USED(opline)) { const zend_op *op = new_op_array->opcodes;