Re: trapping fatal errors...?

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

 



On Mon, June 12, 2006 5:00 pm, Christopher J. Bottaro wrote:
> Hello,
> How can I trap a fatal error (like calling a non existant method,
> requiring
> a non existant file, etc) and go to a user defined error handler?  I
> tried
> set_error_handler(), but it seems to skip over the errors I care
> about.

I don't think you CAN...

The closest you could come, after all the set_error_handler and
php.ini settings to log and not display etc, would, maybe, be to wrap
everything in an ob_start() and search output for ERROR: -- which
really sucks, but my boss does it that way...

I think, though, that a syntax error would still get triggered before
the ob_start() every had a chance, unless you ALSO wrap it all up in
an include() somewhere outside the whole app...

This gets pretty ugly, pretty fast, but I suppose as a last-ditch
effort on top of all the file_exists() etc would be... okay.

There is a certain point where the real problem is insufficient
testing, though, and I suspect that is where you'd have to be for the
ob_start() hack to be a "win"...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
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