#22430 closed defect (bug) (duplicate)
wp_ob_end_flush_all bug when zlib.output_compression = On
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | 2.8 |
| Severity: | major | Keywords: | |
| Cc: |
Description
When zlib.output_compression is set to On, the function wp_ob_end_flush_all throws the following error:
Notice: ob_end_flush() [ref.outcontrol]: failed to delete buffer zlib output compression in /wp-includes/functions.php on line 2683
You can see this error e.g. when opening /wp-login.php in browser.
Critical Issue related to this bug: it also affects usage of /wp-admin/customize.php - the preview results in a blank page. Seems that the error avoids ajax snippets from getting loaded succesfully.
Hotfix is replacing in /wp-includes/functions.php
function wp_ob_end_flush_all() {
$levels = ob_get_level();
for ($i=0; $i<$levels; $i++)
ob_end_flush();
}
with
function wp_ob_end_flush_all() {
//$levels = ob_get_level();
//for ($i=0; $i<$levels; $i++)
// ob_end_flush();
}
This issue occurs in all browsers (ie,ff,opera, etc) with both latest versions of WordPress, 3.4.2 and latest nightly build on a LAMP system with PHP Version 5.3.10-1~dotdeb.0.
PHP zlib settings:
Directive Local Value Master Value zlib.output_compression On Off zlib.output_compression_level 5 -1 zlib.output_handler no value no value
Change History (5)
comment:1
SergeyBiryukov — 6 months ago
comment:2
SergeyBiryukov — 6 months ago
- Keywords needs-patch removed
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
- Version changed from trunk to 2.8
Going to close as a duplicate of #18525, which has patches.
The same notice is mentioned in ticket:18525:9.
comment:3
Matthias Reuter — 6 months ago
- Resolution duplicate deleted
- Status changed from closed to reopened
Hi Sergey,
thanks for relating the other tickets to this issue. Currently WordPress per default is not compatible with zlib enabled. While Server-Side-Compression is recommened by search engines and most browsers, the other tickets linked by you recommend either disabling zlib or inserting a hotfix.
I don't want to live with a hotfix over the next years which needs to be re-applied manually with every WordPress update.
I would recommend dropping support for PHP 5.2 (or even check wether PHP 5.3 is on server) to avoid that a compatibility function (wp_ob_end_flush_all()) for PHP 5.2 produces new errors on PHP 5.3 installations with zlib enabled.
So I hope that the developers of WordPress will fix this issue and don't let me hotfix that the next years until PHP 5.2 support is finally dropped.
Kind regards,
Matthias
- Resolution set to duplicate
- Status changed from reopened to closed
Rather than hacking core, try this one-line plugin on for size:
remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 );
We may be at the point where we can eliminate this from core. I'll look into it at the start of the 3.6 cycle. Closing this as a duplicate of #18525 makes sense, because that ticket is reporting the same problem. You disagree with the solution, and that's completely fine, but you should voice it there. (For what it's worth, I also don't like the solution, which is why I myself have not committed it.)
comment:5
Matthias Reuter — 6 months ago
Wow, nacin, this fix works great and I don't need to touch the core - perfect :)

Related: #18239, #18525