NYCPHP Meetup

NYPHP.org

[nycphp-talk] PhP error handler help -- totally confounded

Cliff Hirsch cliff at pinestream.com
Mon Feb 4 16:55:14 EST 2008


> blasasdfsdfgorg(;
> This makes a parse error.  PHP won't get far enough to use your custom
> handler because it will just die.

> The following error types cannot be handled with a user defined
> function: *E_ERROR*, *E_PARSE*, *E_CORE_ERROR*, *E_CORE_WARNING*,
> *E_COMPILE_ERROR*, *E_COMPILE_WARNING*, and most of *E_STRICT* raised in
> the file where *set_error_handler()* is called.

> foobar(); (the function that doesn't exist):
> suggests that normal custom error handlers won't be able to catch this.

I think I have just figured this out after wasting an afternoon. My errors
until now have mainly been smarty compile errors, which are caught.

Funny how all the examples on the php web site are like:

function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars) {
    $errortype = array (E_ERROR => 'Error',

Even though these aren't caught!

So...the moral of the story is you need two error handlers...the customer,
user friendly, error handler, and the error_log file in your php.ini if you
want to keep php errors separate from Apache errors.






More information about the talk mailing list