Hi again,
Just wandering if someone could help me on this one- I'm quite anxious
to get something together. As I said in the last email I just want to
use ob_start("ob_gzhandler") but it doesn't seem to work with the error
function. I think it might be something to do with not being allowed
within a 'callback function'- well that's what it says on the php
manual. The thing is I'm not sure what that means, I find that section
not particularly clear. Please can someone help!
IG wrote:
Hi,
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") ?
Thanks.
Ianob_
|ob_start("ob_gzhandler");|
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php