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