Repository navigation
Conversation
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.
devnexen
requested changes
Nov 27, 2026
| @@ -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; | |||
Member
There was a problem hiding this comment.
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -1938,7 +1938,11 @@ 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;
+ if (!SG(sapi_headers).http_status_line) {
+ SG(sapi_headers).http_status_line = _old_http_status_line;
+ } else if (_old_http_status_line) {
+ efree(_old_http_status_line);
+ }
} zend_catch {
CG(in_compilation) = _old_in_compilation;
EG(current_execute_data) = _old_current_execute_data;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While the SOAP error handler is active, a non-fatal diagnostic drops a custom HTTP status line set with
header(): the line is set toNULLbefore the previous error handler is called and only restored in thezend_catchblock, which runs when that handler bails out. The client gets the default reason phrase and the custom line is leaked. It is now also restored when the handler returns.To reproduce
Run under
php -S:Before:
HTTP/1.1 404 Not FoundAfter:
HTTP/1.1 404 Custom Reason, as with the handler off.