-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix GH-8218: ob_end_clean does not reset Content-Encoding header #8353
Conversation
The fix for phpGH-7953 introduced a regression by being to deliberate adding the respective headers. These must only be added, if the handler starts, but is not finalizing.
@@ -311,7 +311,7 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c | |||
mimetype = SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE; | |||
} | |||
|
|||
if (mimetype != NULL && (!(output_context->op & PHP_OUTPUT_HANDLER_CLEAN) || (output_context->op & PHP_OUTPUT_HANDLER_START))) { | |||
if (mimetype != NULL && (!(output_context->op & PHP_OUTPUT_HANDLER_CLEAN) || ((output_context->op & PHP_OUTPUT_HANDLER_START) && !(output_context->op & PHP_OUTPUT_HANDLER_FINAL)))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could also be written as bit set operation; I'm not sure whether that would be more legible.
I'm not sure whether we should add regression tests for this. Unfortunately, the test runner does not support to check for missing headers, so we would need to set up a socket test. |
I've already seen it and everything looks good. GJ |
++ to get it in, got a report from alpinelinux about regression |
9bd468d is when it was broken |
If there are no objections, I'll merge this on monday at the latest. |
If an output handler has not yet been started, calling `ob_clean()` causes it to start. If that happens, we must not forget to set the `Content-Encoding` and `Vary` headers. Closes GH-7960.
The fix for GH-7953 introduced a regression by being to deliberate
adding the respective headers. These must only be added, if the
handler starts, but is not finalizing.