[php-src] Issue #8218: ob_end_clean does not reset Content-Encoding header
| From: | DanielnetoDotCom | Date: | Tue, 12 Apr 2022 13:20:33 +0000 |
| Subject: | [php-src] Issue #8218: ob_end_clean does not reset Content-Encoding header | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240894@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8218
Comment Author: DanielnetoDotCom
> I'm no PMA dev. We fixed it locally for our clients. Then I reported the bug report :-)
>
> The export function is broken. Browser says it cannot understand the "download
> content" as its plain text but the header is set to
gzip. So
> the browser expects gzip-encoded content.
>
> edit: For reference this is our PMA fix we rolled out:
>
> ```diff
> --- a/libraries/classes/Controllers/ExportController.php 2022-03-18 14:35:05.436069330
> +0100
> +++ b/libraries/classes/Controllers/ExportController.php 2022-03-18 14:34:33.419300421
> +0100
> @@ -305,6 +305,7 @@
> $hasBuffer = false;
> }
> } while ($hasBuffer);
> + header_remove("Content-Encoding");
> }
>
> $tables = [];
> ```
>
> I'll create a PMA bug report if the new behavior is intended.
That is what I did as a work around
```
function doesPHPVersioHasOBBug(){
if (version_compare(phpversion(), "8.1.4", "==")) {
return true;
} else if (version_compare(phpversion(), "8.0.17", "==")) {
return true;
} else {
return false;
}
}
function _ob_end_clean(){
ob_end_clean();
if(!doesPHPVersioHasOBBug()){
header_remove("Content-Encoding");
}
}
```