Merge branch 'PHP-8.2'

* PHP-8.2:
  Fallback to first line of function when ex->opline is NULL (#10003)
This commit is contained in:
Christoph M. Becker 2022-12-05 12:45:49 +01:00
commit 6109b80926
No known key found for this signature in database
GPG Key ID: D66C9593118BCCB6

View File

@ -638,6 +638,10 @@ ZEND_API uint32_t zend_get_executed_lineno(void) /* {{{ */
ex = ex->prev_execute_data; ex = ex->prev_execute_data;
} }
if (ex) { 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 && if (EG(exception) && ex->opline->opcode == ZEND_HANDLE_EXCEPTION &&
ex->opline->lineno == 0 && EG(opline_before_exception)) { ex->opline->lineno == 0 && EG(opline_before_exception)) {
return EG(opline_before_exception)->lineno; return EG(opline_before_exception)->lineno;