How to fix ob_end_flush() error?

At the bottom of my WP-admin pages I get this:

ob_end_flush(): failed to send buffer of zlib output compression (1) in C:\Users\anticaking\Desktop\Website\wordpress\wp-includes\functions.php on line 3718.

Line 3718:

function wp_ob_end_flush_all() {
    $levels = ob_get_level();
    for ($i=0; $i<$levels; $i++)
        ob_end_flush();
}

I’ve removed all plug-ins and swapped themes and still get the error so I cannot pinpoint what is causing it. What is it and how do I fix this?

4 Answers
4

I also had this issue with wordpress and couldn’t properly resolve it. Ended up with this filthy hack to prevent the error from showing:

// Get the current error reporting level
$e_level = error_reporting();

// Turn off error reporting
error_reporting(0);

ob_start();
echo 'This is a horrible hack';
$buffer_contents = ob_get_clean();
ob_end_flush();

// Reset error reporting level to previous
error_reporting($e_level);

Everything does seem to work as expected, however I’m not proud of it!

Leave a Comment