Re: ob_start("ob_gzhandler") and error handling functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



# php@xxxxxxxxxxxxxxxxxxxx / 2006-12-20 14:12:11 +0000:
> I include a php file at the beginning of every web page in this site. 
> This include file has an error handling function and starts output 
> buffering...
> 
> // Start of Error Handler
> error_reporting(E_ALL ^ E_NOTICE);
> ini_set('log_errors','1');
> 
> function ErrHandler($err,$err_string='',$err_file,$err_line)
>    {
>        // Do error logging thang
> 
>        ob_end_clean();// Clear buffer
>   
>        include('/path/incs/errors/errors.inc');// Output friendly error 
> page
>        exit();
>    }   
> 
> set_error_handler('ErrHandler');
> 
> // End of Error Handler
> 
> It works great and the error handler kicks in if there is an error on 
> the page and outputs a friendly page instead. I really wanted to gzip 
> the pages by using ob_start("ob_gzhandler") but it doesn't work. I think 
> it is because of the error handler function trying to clear the buffer 
> (see the line ob_end_clean() which I assume becomes 
> ob_end_clean("ob_gzhandler") ). It says on the php functions page- 
> *ob_start()* may not be called from a callback function. If you call 
> them from callback function, the behavior is undefined. If you would 
> like to delete the contents of a buffer, return "" (a null string) from 
> callback function.
> 
> As I am new to this- I don't really understand what it is trying to get 
> at. Is there a way of me using my error handler and evoking the 
> ob_start("ob_gzhandler") ?

I don't use this stuff myself, but it looks like the second half
of this comment might be applicable to you:
http://cz2.php.net/manual/en/function.ob-end-clean.php#71092

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux