From 7e3eb14284a3a1dfdc02a0658b82d6ddb1dfd720 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Sat, 26 Nov 2022 13:49:01 +0100 Subject: [PATCH] Fallback to first line of function when ex->opline is NULL This can happen due to missing SAVE_OPLINE() in the VM --- Zend/zend_execute_API.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 7ccfaa6034ae0..3ef2dec1036c2 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -627,6 +627,10 @@ ZEND_API uint32_t zend_get_executed_lineno(void) /* {{{ */ ex = ex->prev_execute_data; } if (ex) { + if (!ex->opline) { + /* Missing SAVE_OPLINE()? Falling back to first line of function */ + return ex->func->op_array.opcodes[0].lineno; + } if (EG(exception) && ex->opline->opcode == ZEND_HANDLE_EXCEPTION && ex->opline->lineno == 0 && EG(opline_before_exception)) { return EG(opline_before_exception)->lineno;