I use register_shutdown_function() to let PHP call a function at any time my script crashes. After I've logged that to a file, I want to display a beautiful error-sorry-message to the user.
To do that, I want to clean the current output buffer. I think there's a stack of output buffers (not sure), so the big question is if I could simply call ob_end_clean() in my shutdown-callback function and then print out my error page?
At least, on my MAMP environment on the mac (local) I can echo out something in my callback function, even though in the documentation some people claim that this is impossible.
But if that works, I must be sure that anything that went previously to the output buffer really gets cleaned. On the other hand, the next question would be what happens with sent headers?