|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-04-02 10:35 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
When turning on output buffering and setting a call back function like: ob_start('callback_function'); The function is called right away. Not just in the end of the script. Try this sample: ob_start('ob_gzhandler'); ob_end_clean(); echo "Step 1<br>\n"; flush(); sleep(1); echo "Step 2<br>\n"; flush(); Function ob_end_clean should cancel the buffering and it dose, but ob_gzhandler is already called. It is called when ob_start is turned one. Now the script fails because the function ob_gzhandler has already set Content-Encoding header (meaning the browser expects compressed content). A simple one: function callback_function($content) { die("Stop!"); return $content; } ob_start('callback_function'); ob_end_clean(); echo "Step 1<br>\n"; flush(); sleep(1); echo "Step 2<br>\n"; flush(); The script is stops before ob_end_clean is called. I think that the problem is general. I have tested the problem on more than one computer. The newest installation was a preinstalled Red Hat with a PHP version 4.3.1