Does die() do an ob_end_flush()?
Yes it does. Any time the script ends gracefully, the buffers will be emptied. The only non-graceful endings are if it segmentation faults or if it's killed (signal 9 SIG_KILL). The only place that die()
does a hard-kill of the process is if you call it inside of a register_shutdown_function
(But the buffers are flushed before the shutdown function is called, so there's no issue there). See Connection Handling for some more information...