PHP 8.0: Default error reporting is set to
The PHP INI directive
error_reporting controls which types of errors, warnings, and notices should be reported (either to screen or to logs).
In PHP 8.0, the default is changed to
- error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT + error_reporting = E_ALL
error_reporting value expects a bit-mask, and the default value prior to PHP 8.0 was the value recommended for production:
E_ALL & ~E_DEPRECATED & ~E_STRICT. This value prevented deprecation notice and strict notices from making it to error logs or screen.
In a production system, the
display_errorsvalue must be set to
Off, which will hide all errors from being printed on the screen, but allows error logs to record them.
Backwards Compatibility Impact
With the default
error_reporting value set to
E_ALL, PHP will trigger the error handler for all PHP errors, notices, and warnings. This is a good move because it can reveal deprecation notices and that were hidden due to the previous configuration.
To bring back the same functionality as PHP 7.4:
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT