From 45e224cf518354a8ce10255ac1816d1d10e6bce2 Mon Sep 17 00:00:00 2001 From: Adam Saponara Date: Fri, 21 Oct 2022 21:18:55 -0400 Subject: [PATCH] Fix GH-9709: Guard against current_execute_data==NULL in is_handle_exception_set --- NEWS | 3 +++ Zend/zend_exceptions.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 00716f4495006..e7839bac96bb8 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2022, PHP 8.0.26 +- CLI: + . Fixed bug GH-9709 (Null pointer dereference with -w/-s options). (Adam Saponara) + - Core: . Fixed bug GH-9752 (Generator crashes when interrupted during argument evaluation with extra named params). (Arnaud) diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 6ec06d772bc61..f168c13636022 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -146,7 +146,8 @@ void zend_exception_restore(void) /* {{{ */ static zend_always_inline zend_bool is_handle_exception_set() { zend_execute_data *execute_data = EG(current_execute_data); - return !execute_data->func + return !execute_data + || !execute_data->func || !ZEND_USER_CODE(execute_data->func->common.type) || execute_data->opline->opcode == ZEND_HANDLE_EXCEPTION; }