From 31031d674567505ec507a62a61b5b52b5964514a Mon Sep 17 00:00:00 2001 From: lacatoire Date: Thu, 26 Nov 2026 18:01:11 +0100 Subject: [PATCH] Fix SOAP error handler dropping a custom HTTP status line The status line was cleared before calling the previous error handler and only restored when that handler bailed out, so any non-fatal diagnostic lost it. --- ext/soap/soap.c | 1 + .../error_handler_keeps_status_line.phpt | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 ext/soap/tests/error_handler_keeps_status_line.phpt diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 3bba56782f3b..9f061bc4aa05 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1938,6 +1938,7 @@ static zend_never_inline ZEND_COLD void soap_real_error_handler(int error_num, z SG(sapi_headers).http_status_line = NULL; zend_try { old_error_handler(error_num, error_filename, error_lineno, message); + SG(sapi_headers).http_status_line = _old_http_status_line; } zend_catch { CG(in_compilation) = _old_in_compilation; EG(current_execute_data) = _old_current_execute_data; diff --git a/ext/soap/tests/error_handler_keeps_status_line.phpt b/ext/soap/tests/error_handler_keeps_status_line.phpt new file mode 100644 index 000000000000..91c7c59c1da8 --- /dev/null +++ b/ext/soap/tests/error_handler_keeps_status_line.phpt @@ -0,0 +1,36 @@ +--TEST-- +SOAP error handler keeps a custom HTTP status line on a non-fatal error +--EXTENSIONS-- +soap +--SKIPIF-- + +--FILE-- + ['ignore_errors' => true]])); +echo $http_response_header[0], "\n", $body, "\n"; +?> +--EXPECT-- +HTTP/1.1 404 Custom Reason +plain