When using $config->debugIf to turn on debug mode, no PHP deprecated errors are displayed or logged.
Expected behavior
When using $config->debugIf , the behaviour should be exactly the same as with $config->debug = true;
Actual behavior
ProcessWire sets error_reporting to not show any php deprecated errors before it evaluates the debugIf setting.
Optional: Suggestion for a possible fix
In /wire/core/ProcessWire.php the following code block
// If debug mode is on then echo all errors, if not then disable all error reporting
if($config->debug) {
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
} else {
error_reporting(0);
ini_set('display_errors', 0);
}
should be moved below the code block, where debugIf is evaluated.
Steps to reproduce the issue
Make sure that your server/webhosting is configured to show and/or log php errors, and that it allows PHP to decide, if errors are shown or hidden
In /site/config.php, set $config->debug = false
In /site/config.php, set $config->debugIf = 'YOUR_IP_ADDRESS'; , where YOUR_IP_ADRESS must be your actual IP-adress
Put trigger_error( 'This is a deprecated error', E_USER_DEPRECATED); somewhere on your page template, where it will be executed, when the page is displayed
Reload the page in the browser
The triggered error won’t be displayed nor logged anywhere
Short description of the issue
When using
$config->debugIf
to turn on debug mode, no PHP deprecated errors are displayed or logged.Expected behavior
When using
$config->debugIf
, the behaviour should be exactly the same as with$config->debug = true;
Actual behavior
ProcessWire sets
error_reporting
to not show any php deprecated errors before it evaluates thedebugIf
setting.Optional: Suggestion for a possible fix
In /wire/core/ProcessWire.php the following code block
should be moved below the code block, where
debugIf
is evaluated.Steps to reproduce the issue
$config->debug = false
$config->debugIf = 'YOUR_IP_ADDRESS';
, whereYOUR_IP_ADRESS
must be your actual IP-adresstrigger_error( 'This is a deprecated error', E_USER_DEPRECATED);
somewhere on your page template, where it will be executed, when the page is displayedSetup/Environment