Skip to content

Backported display_errors-handling to sf1 #328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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