JosephLenton / PHP-Error

Better error reporting for PHP, and prettier too!
1.35k stars 151 forks source link

NOTICE is not handled #33

Closed NateRadebaugh closed 11 years ago

NateRadebaugh commented 11 years ago

Even when setting error_reporing_on to E_ALL | E_STRICT, I still see the small default PHP notice rather than PHP-Error's full page dialog.

\php_error\reportErrors(array(
     'catch_supressed_errors' => true,
     'error_reporting_on' => E_ALL | E_STRICT,
));
Notice!

ErrorException [ Notice ]: Use of undefined constant asdf - assumed 'asdf'

Shouldn't E_ALL cover E_NOTICE and E_USER_NOTICE?

This may be a bug in the script or a bug in the documentation.

JosephLenton commented 11 years ago

Which web server are you using?

NateRadebaugh commented 11 years ago

I have an apache webserver running.

It turns out the documentation on set_error_handler says:

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.

Do you think this is the issue? The PHP-Error only seems to catch things that cause the page to crash, and this notice doesn't stop the page from loading.

JosephLenton commented 11 years ago

That only applies to 'set_error_handler', you can catch those bugs using 'register_shutdown_function', which still gets called.

I will test out E_NOTICE when I get home later.

NateRadebaugh commented 11 years ago

thanks.

NateRadebaugh commented 11 years ago

Did you get a chance to look at this? It might be an issue with my server configuration, but I'm not sure where to look if it is. Any thoughts?

JosephLenton commented 11 years ago

I've done some testing with E_NOTICE, and they are working fine. I am guessing this is either being hit before PHP Error is loaded, or it's a configuration file.

I cannot replicate any issues with E_NOTICE errors. However it might be that it only occurs with certain E_NOTICE errors, and so I may be testing with the wrong ones.