Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which types of errors should stop the system, in released php web system?

Tags:

php

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?

like image 691
js_ Avatar asked Oct 06 '22 10:10

js_


1 Answers

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.

like image 131
Mihai Iorga Avatar answered Oct 09 '22 00:10

Mihai Iorga