note 76102 added to ref.outcontrol
| From: | jgeewaxatgmail at osu1 dot php dot net | Date: | Sat, 30 Jun 2007 02:02:47 +0000 |
| Subject: | note 76102 added to ref.outcontrol | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128105@lists.php.net to get a copy of this message | ||
It seems that while using output buffering, an included file which calls die() before the output
buffer is closed is flushed rather than cleaned. That is, ob_end_flush() is called by default.
<?php
// a.php (this file should never display anything)
ob_start();
include('b.php');
ob_end_clean();
?>
<?php
// b.php
print "b";
die();
?>
This ends up printing "b" rather than nothing as ob_end_flush() is called instead of
ob_end_clean(). That is, die() flushes the buffer rather than cleans it. This took me a while to
determine what was causing the flush, so I thought I'd share.
----
Server IP: 217.160.72.57
Probable Submitter: 201.229.183.217
----
Manual Page -- http://www.php.net/manual/en/ref.outcontrol.php
Edit -- https://master.php.net/note/edit/76102
Del: integrated -- https://master.php.net/note/delete/76102/integrated
Del: useless -- https://master.php.net/note/delete/76102/useless
Del: bad code -- https://master.php.net/note/delete/76102/bad+code
Del: spam -- https://master.php.net/note/delete/76102/spam
Del: non-english -- https://master.php.net/note/delete/76102/non-english
Del: in docs -- https://master.php.net/note/delete/76102/in+docs
Del: other reasons-- https://master.php.net/note/delete/76102
Reject -- https://master.php.net/note/reject/76102
Search -- https://master.php.net/manage/user-notes.php