Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

cmb69
Copy link
Contributor

@cmb69 cmb69 commented Apr 12, 2022

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.

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)))) {
Copy link
Contributor Author

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.

@cmb69
Copy link
Contributor Author

cmb69 commented Apr 12, 2022

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.

@cmb69 cmb69 linked an issue Apr 12, 2022 that may be closed by this pull request
@arcanisgk
Copy link

I've already seen it and everything looks good. GJ

@andypost
Copy link
Contributor

++ to get it in, got a report from alpinelinux about regression

@andypost
Copy link
Contributor

9bd468d is when it was broken

@cmb69
Copy link
Contributor Author

cmb69 commented Apr 21, 2022

If there are no objections, I'll merge this on monday at the latest.

andypost referenced this pull request Apr 21, 2022
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.
algitbot pushed a commit to alpinelinux/aports that referenced this pull request Apr 22, 2022
algitbot pushed a commit to alpinelinux/aports that referenced this pull request Apr 23, 2022
@cmb69 cmb69 closed this in 30f4c72 Apr 25, 2022
@cmb69 cmb69 deleted the cmb/gh8218 branch April 25, 2022 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ob_end_clean does not reset Content-Encoding header
3 participants