I know what the error_reporting
values mean. I know -1
means "show all" and 0
means "show none".
But nowhere is specified what is the value set by default, when nothing is specified by the user.
Trying phpinfo()
I see
...
Configuration File (php.ini) Path => /usr/local/etc/php
Loaded Configuration File => (none)
...
So, given there's no php.ini
loaded, what is the default value/behaviour of error_reporting
?
CodePudding user response:
From the documentation of the config file options
The default value is
E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
. This setting does not showE_NOTICE
,E_STRICT
andE_DEPRECATED
level errors. You may want to show them during development.
In PHP 8.0, the default is changing to E_ALL
. See https://php.watch/versions/8.0/error-display-E_ALL
CodePudding user response:
In PHP 5.3 or newer versions but prior to PHP 8.0, the default error_reporting level was:
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
This means that all type of errors are reported except E_NOTICE, E_STRICT, and E_DEPRECATED.
Since PHP 8.0, the default error_reporting level is E_ALL.
error_reporting = E_ALL
Have a look: https://lindevs.com/default-error-reporting-level-is-e_all-in-php-8-0/