-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
ob_end_clean does not reset Content-Encoding header #8218
Comments
Can you explain how does it break it? Would you be able to link to a commit in PMA where you added the hack? I can't see any recent changes in PMA GitHub. |
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 edit: --- 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. |
If it wants to send plain text then why is it enabling gzipped output buffering in the first place? |
Didn't look at the code in-depth. I assume it's the default code path and always enables output buffering. PMA only disables the buffering right before sending the content as downloadable content. Since PMA is widely used and the new behavior clearly breaks an important part of PMA I wanted to check-in here first. |
@cmb69 Hope you don't mind, I am assigning this bug to you. I did some analysis and I agree that calling |
It seems to me that there is some kind of confusion; the target of https://www.php.net/manual/en/function.ob-end-clean.php
if you previously called https://www.php.net/manual/en/function.ob-gzhandler.php
which is what is really needed: a callback to |
Correct, |
Note that |
That is what I did as a work around
|
@DanielnetoDotCom Thank you so much; but I have a curiosity, we do not know if this is going to be solved in future versions; It would be convenient to always clean the header. function _ob_end_clean(){
ob_end_clean();
header_remove("Content-Encoding");
} |
A
I agree also I just changed my code to always clean the header and I could confirm it is working in all php versions I have tested |
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.
* PHP-8.0: Fix GH-8218: ob_end_clean does not reset Content-Encoding header
* PHP-8.1: Fix GH-8218: ob_end_clean does not reset Content-Encoding header
Description
Follow up from: #7953
The following code:
Resulted in this output:
Please note that the
Content-Encoding
header is set togzip
but the output is plain text.This breaks the export + download functionality of phpMyAdmin. We fixed the export function by adding an additional
header_remove("Content-Encoding")
after cleaning and ending the output buffering. Is this new behavior intended and PMA should fix it or a bug in PHP?PHP Version
8.0.17 + 8.1.4
Operating System
No response
The text was updated successfully, but these errors were encountered: