Why not to use highest error reporting level in PHP? -


I want you to tell the reason why someone should not use the most likely error reporting level in PHP?

Ways to set the highest level:

PHP & lt; 5.4:

error_reporting (E_ALL | E_STRICT);

PHP> = 5.4:

  error_reporting (E_ALL);  

PHP all versions (as is recommended):

  error_reporting (2147483647);  

PHP all versions (all my errors in config -1, and are easy to remember)

  error_reporting (- 1); 

My experience:

  • There is no reason for short reporting levels
  • Any time
  • And to overwrite the line to convert all the errors into exceptions and the customized exception class.

I personally prefer the code at the highest level of error reporting, and fix all the alerts generated by my code. However, I can imagine some reasons why you can work at a low level:

  1. You can work with a legacy code that emits a lot of warnings. If the code works correctly it is not a problem, but "noise" can get distracted and prevent you from seeing actual problems. In this situation, this error may be desirable to reduce reporting level.
  2. In a production environment, you can only log errors, it has two advantages, that means there are only significant problems in your error log which require attention, and this disk space (And will reduce disk I / O).

Separating subject: In order to prevent the environment from producing the PHP errors (which may contain sensitive information, eg database connection properties), "display_errors = off" "And" error_logging = on ", and gather a log of errors as soon as they are. Therefore, your production error_porting level and related settings may vary for the development you like to do in development.


Comments