For some reason, nobody seems to acknowledge there is a bug with flush() in PHP 5.4.

In any previous version of PHP, you could just do:


flush();

and the PHP output buffer would be sent to Apache which would in turn send it to your web browser.

We are not talking about any side effects due to compression or charset sniffing here. We are talking about: flush() was working just fine.

And then compes PHP 5.4 and it doesn’t work any more. And you revert to PHP 5.3 and it works again. PHP 5.4, broken again. And you can reproduce that to infinity but still, nobody wants to acknowledge it.

So we had to find a workaround. Here it is: just replace your flush() calls with a custom call like flush54() defined like this:


 function flush54()
{
  @ob_end_flush();
  flush();
}

This will restore the initial behaviour…