I want you to give reasons why someone should not use the highest possible error reporting level in PHP?
Ways to set highest level:
PHP < 5.4:
error_reporting(E_ALL | E_STRICT);
PHP >= 5.4:
error_reporting(E_ALL);
PHP all versions (as recommended for config files):
error_reporting(2147483647);
PHP all versions (my config, -1 will contain all errors and is easy to remember)
error_reporting(-1);
My experiences:
I personally prefer to code at the highest level of error reporting, and fix all warnings generated by my code. However, I can envisage a couple of reasons why you might want to work at a lower level:
Off topic aside: In production environment you should run "display_errors = Off" and "error_logging = On" to prevent users from seeing PHP errors (which may contain sensitive information e.g. database connection properties), and collect a log of errors as they occur. So your production error_reporting level and related setting may be different to what you'd prefer to run in development.
I think there is no good reason, except maybe what Jim says in his first point, running legacy code that cannot or won't be changed.
You should most certainly run it at the highest level during development and wipe out every warning and notice unless you have a great reason not to.
If you have a great reason not to fix a notice during development, you should document it and use the error contorl operator to avoid cluttering the logs.
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