Skip to content

Commit

Permalink
Backported display_errors-handling to sf1
Browse files Browse the repository at this point in the history
  • Loading branch information
thirsch authored and thePanz committed Feb 20, 2024
1 parent 81205f6 commit 1b79957
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/config/sfApplicationConfiguration.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,23 @@ public function initConfiguration()
}

// error settings
ini_set('display_errors', $this->isDebug() ? 'on' : 'off');
// Based on the debug setting ($this->isDebug()), it controls if errors should be displayed
// (display_errors). If the application is not in the debug mode or if it's running in a
// CLI, PHPDBG, or embed server API, then errors are not displayed (display_errors is set
// to 0). However, if the application is in debug mode and errors are not already logged to
// the error log, then errors are displayed (display_errors is set to 1).
if (
!$this->isDebug()
|| !in_array(PHP_SAPI, array('cli', 'phpdbg', 'embed'), true)
) {
ini_set('display_errors', 0);
} elseif (
!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN)
|| ini_get('error_log')
) {
// CLI - display errors only if they're not already logged to STDERR
ini_set('display_errors', 1);
}
error_reporting(sfConfig::get('sf_error_reporting'));

// initialize plugin configuration objects
Expand Down

0 comments on commit 1b79957

Please sign in to comment.