note 77223 added to function.ob-start
| From: | (ahaig@ridiculouspower.com) | Date: | Mon, 20 Aug 2007 20:17:45 +0000 |
| Subject: | note 77223 added to function.ob-start | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129650@lists.php.net to get a copy of this message | ||
When a script ends, all buffered output is flushed (this is not a bug: http://bugs.php.net/bug.php?id=42334&thanks=4).
What happens when the script throws an error (and thus ends) in the middle of an output buffer? The
script spits out everything in the buffer before printing the error!
Here is the simplest solution I have been able to find. Put it at the beginning of the error
handling function to clear all buffered data and print only the error:
$handlers = ob_list_handlers();
while ( ! empty($handlers) ) {
ob_end_clean();
$handlers = ob_list_handlers();
}
----
Server IP: 69.147.83.197
Probable Submitter: 76.20.251.70
----
Manual Page -- http://www.php.net/manual/en/function.ob-start.php
Edit -- https://master.php.net/note/edit/77223
Del: integrated -- https://master.php.net/note/delete/77223/integrated
Del: useless -- https://master.php.net/note/delete/77223/useless
Del: bad code -- https://master.php.net/note/delete/77223/bad+code
Del: spam -- https://master.php.net/note/delete/77223/spam
Del: non-english -- https://master.php.net/note/delete/77223/non-english
Del: in docs -- https://master.php.net/note/delete/77223/in+docs
Del: other reasons-- https://master.php.net/note/delete/77223
Reject -- https://master.php.net/note/reject/77223
Search -- https://master.php.net/manage/user-notes.php