Skip to content

Commit 30f4c72

Browse files
committed
Fix GH-8218: ob_end_clean does not reset Content-Encoding header
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.
1 parent 3b73545 commit 30f4c72

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

NEWS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ PHP NEWS
2020
. Fixed bug #77023 (FPM cannot shutdown processes). (Jakub Zelenka)
2121
. Fixed comment in kqueue remove callback log message. (David Carlier)
2222

23+
- Iconv:
24+
. Fixed bug GH-8218 (ob_end_clean does not reset Content-Encoding header).
25+
(cmb)
26+
2327
- Intl:
2428
. Fixed bug GH-8364 (msgfmt_format $values may not support references). (cmb)
2529

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

43+
- zlib:
44+
. Fixed bug GH-8218 (ob_end_clean does not reset Content-Encoding header).
45+
(cmb)
46+
3947
14 Apr 2022, PHP 8.0.18
4048

4149
- Core:

ext/iconv/iconv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c
311311
mimetype = SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE;
312312
}
313313

314-
if (mimetype != NULL && (!(output_context->op & PHP_OUTPUT_HANDLER_CLEAN) || (output_context->op & PHP_OUTPUT_HANDLER_START))) {
314+
if (mimetype != NULL && (!(output_context->op & PHP_OUTPUT_HANDLER_CLEAN) || ((output_context->op & PHP_OUTPUT_HANDLER_START) && !(output_context->op & PHP_OUTPUT_HANDLER_FINAL)))) {
315315
size_t len;
316316
char *p = strstr(get_output_encoding(), "//");
317317

ext/zlib/zlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ static int php_zlib_output_handler(void **handler_context, php_output_context *o
281281
return FAILURE;
282282
}
283283

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

287287
if (SUCCESS == php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_FLAGS, &flags)) {

0 commit comments

Comments
 (0)