Following fallout in linked tickets we should audit our remaining flush calls to make sure they are necessary and are correctly implemented.
The following are rules and notes regarding flush calls:
1. We cannot flush if output buffering is active, instead ob_flush must be called to flush to the output buffer. Output buffering may be enabled through a variety of means such as ob_start, output_buffering php.ini directive, ob_gzhandler in php.ini, etc.
2. ob_flush sends output up to the next outer level of output buffering. If ob_flush is called at the topmost output buffering level, headers may no longer be set via header() calls.
3. The sequence of ob_start -> ob_flush -> ob_get_clean sends output to browser. Even if no output was generated so far the empty output buffer is "flushed" such that headers can no longer be sent (
Some specific aspects to investigate:
1. Does cron properly call ob_flush when output buffering is enabled, instead of flush?
2. Does cron properly flush output all the way to the browser when output buffering is enabled in php.ini via any of the possibilities listed above?
3. The uncommenting of flush that happened as part of 3.1 cron should probably be backported to 3.0.