Skip to content

Commit

Permalink
Fix GH-8218: ob_end_clean does not reset Content-Encoding header
Browse files Browse the repository at this point in the history
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.

Closes GH-8353.
  • Loading branch information
cmb69 committed Apr 25, 2022
1 parent 3b73545 commit 30f4c72
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ PHP NEWS
. Fixed bug #77023 (FPM cannot shutdown processes). (Jakub Zelenka)
. Fixed comment in kqueue remove callback log message. (David Carlier)

- Iconv:
. Fixed bug GH-8218 (ob_end_clean does not reset Content-Encoding header).
(cmb)

- Intl:
. Fixed bug GH-8364 (msgfmt_format $values may not support references). (cmb)

Expand All @@ -36,6 +40,10 @@ PHP NEWS
. Fixed php://temp does not preserve file-position when switched to temporary
file. (Bernd Holzmüller)

- zlib:
. Fixed bug GH-8218 (ob_end_clean does not reset Content-Encoding header).
(cmb)

14 Apr 2022, PHP 8.0.18

- Core:
Expand Down
2 changes: 1 addition & 1 deletion ext/iconv/iconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)))) {
size_t len;
char *p = strstr(get_output_encoding(), "//");

Expand Down
2 changes: 1 addition & 1 deletion ext/zlib/zlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ static int php_zlib_output_handler(void **handler_context, php_output_context *o
return FAILURE;
}

if (!(output_context->op & PHP_OUTPUT_HANDLER_CLEAN) || (output_context->op & PHP_OUTPUT_HANDLER_START)) {
if (!(output_context->op & PHP_OUTPUT_HANDLER_CLEAN) || ((output_context->op & PHP_OUTPUT_HANDLER_START) && !(output_context->op & PHP_OUTPUT_HANDLER_FINAL))) {
int flags;

if (SUCCESS == php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_FLAGS, &flags)) {
Expand Down

0 comments on commit 30f4c72

Please sign in to comment.