While developing a php web system, setting E_ALL | E_STRICT
to error_reporting and taking care of all kind of errors including notice errors is good practice.
But in the released system, should I stop the system when notice error occurred?
Or should I stop the system only when E_ERROR occurred and ignore all other errors such as E_WARNING, E_NOTICE, or E_STRICT?
Which types of errors should I handle in my custom error handler and stop(exit) the system?
When you develop a code you should take care of any warning including notices.
For production your should not really halt on errors. Instead you can use set_error_handler()
to manage any errors such as E_USER_ERROR
, E_USER_WARNING
, E_USER_NOTICE
. Redirect client to custom page, display a custom message for any type of error. The point is not to leave the default error information.
You should always have a system that reports any errors encountered to yourself (via e-mail or such) on production servers and take care of them as soon as possible.
On php.net/set_error_handler you have plenty of examples that will make your life a lot easier and help you track errors and warnings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With