Re: trapping fatal errors...?
| From: | Richard Lynch | Date: | Tue, 13 Jun 2006 22:35:20 +0000 |
| Subject: | Re: trapping fatal errors...? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237933@lists.php.net to get a copy of this message | ||
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