Restore output buffer in case of exceptions

From: Date: Sat, 17 Nov 2007 22:36:14 +0000
Subject: Restore output buffer in case of exceptions
Groups: php.internals 
Request: Send a blank email to internals+get-33224@lists.php.net to get a copy of this message
Hello, I'm sorry if that's the wrong list. I am neither a PHP nor a webscripting guy so I'm sorry if this does not make sense. I just thought that it could be useful. PHP 5 supports exception handling. When an exception occurs, PHP does stack unwinding so that it restores the state of the script. But an important state of the script does not get restored: the output. Would it not be a good idea if PHP also did some sort of output buffer unwinding? That is the idea: <?php exceptional_ob_start(); echo "Begin\n"; try { echo "Exception\n"; throw new Exception(); } catch (Exception $e) {} echo "End\n"; exceptional_ob_end_flush(); ?> And that would be the only output: Begin End

« previous php.internals (#33224) next »