note 76845 added to function.ob-gzhandler

From: Date: Wed, 01 Aug 2007 23:18:47 +0000
Subject: note 76845 added to function.ob-gzhandler
Groups: php.notes 
Request: Send a blank email to php-notes+get-129116@lists.php.net to get a copy of this message
faisun at sina dot com: If you read up on output buffering, you'll see that if an output buffer callback returns false, this instructs PHP to output the original string untouched. That's why ob_gzhandler() returns false if the encoding is not supported. When ob_start("ob_gzhandler") is used and encoding is not supported, ob_gzhandler() will return false and PHP outputs the original, uncompressed string. jsnell at e-normous dot com: Output buffering callback functions accept up to two parameters, so this would probably work better for your situation: <?php function ob_gz_handler_no_errors($buffer, $mode) { @ob_gzhandler($buffer, $mode); } ob_start('ob_gzhandler_no_errors'); ?> However, if you're trying to suppress errors caused by headers already being sent, it would be better to start the output buffering earlier, before any output can be sent. ---- Server IP: 69.147.83.197 Probable Submitter: 75.0.38.132 ---- Manual Page -- http://www.php.net/manual/en/function.ob-gzhandler.php Edit -- https://master.php.net/note/edit/76845 Del: integrated -- https://master.php.net/note/delete/76845/integrated Del: useless -- https://master.php.net/note/delete/76845/useless Del: bad code -- https://master.php.net/note/delete/76845/bad+code Del: spam -- https://master.php.net/note/delete/76845/spam Del: non-english -- https://master.php.net/note/delete/76845/non-english Del: in docs -- https://master.php.net/note/delete/76845/in+docs Del: other reasons-- https://master.php.net/note/delete/76845 Reject -- https://master.php.net/note/reject/76845 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129116) next »