MDL-15413 warn admins if display_errors enabled

This commit is contained in:
skodak 2008-07-07 14:34:40 +00:00
parent a2d51ba880
commit b373260475
5 changed files with 11 additions and 2 deletions

View File

@ -568,6 +568,10 @@
print_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'generalbox adminwarning');
}
if (defined('WARN_DISPLAY_ERRORS_ENABLED')) {
print_box(get_string('displayerrorswarning', 'admin'), 'generalbox adminwarning');
}
if (substr($CFG->wwwroot, -1) == '/') {
print_box(get_string('cfgwwwrootslashwarning', 'admin'), 'generalbox adminwarning');
}

View File

@ -102,7 +102,7 @@ $ADMIN->add('server', $temp);
// "debugging" settingpage
$temp = new admin_settingpage('debugging', get_string('debugging', 'admin'));
$temp->add(new admin_setting_special_debug());
$temp->add(new admin_setting_configcheckbox('debugdisplay', get_string('debugdisplay', 'admin'), get_string('configdebugdisplay', 'admin'), ini_get('display_errors')));
$temp->add(new admin_setting_configcheckbox('debugdisplay', get_string('debugdisplay', 'admin'), get_string('configdebugdisplay', 'admin'), ini_get_bool('display_errors')));
$temp->add(new admin_setting_configcheckbox('xmlstrictheaders', get_string('xmlstrictheaders', 'admin'), get_string('configxmlstrictheaders', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('debugsmtp', get_string('debugsmtp', 'admin'), get_string('configdebugsmtp', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('perfdebug', get_string('perfdebug', 'admin'), get_string('configperfdebug', 'admin'), '7', '15', '7'));

View File

@ -302,6 +302,7 @@ $string['denyemailaddresses'] = 'Denied email domains';
$string['digestmailtime'] = 'Hour to send digest emails';
$string['disablecourseajax'] = 'Disable AJAX course editing';
$string['disableuserimages'] = 'Disable User Profile Images';
$string['displayerrorswarning'] = 'Enabling the PHP setting <em>display_errors</em> is not recommended on production sites because some error messages may reveal sensitive information about your server.';
$string['displayloginfailures'] = 'Display login failures to';
$string['docroot'] = 'Moodle Docs document root';
$string['doctonewwindow'] = 'Open in new window';

View File

@ -215,6 +215,10 @@ global $HTTPSPAGEREQUIRED;
error_reporting($CFG->debug);
/// find out if PHP cofigured to display warnings
if (ini_get_bool('display_errors')) {
define('WARN_DISPLAY_ERRORS_ENABLED', true);
}
/// If we want to display Moodle errors, then try and set PHP errors to match
if (!isset($CFG->debugdisplay)) {
//keep it as is during installation

View File

@ -6910,7 +6910,7 @@ function debugging($message='', $level=DEBUG_NORMAL, $backtrace=null) {
}
$from = print_backtrace($backtrace, true);
if (!isset($CFG->debugdisplay)) {
$CFG->debugdisplay = ini_get('display_errors');
$CFG->debugdisplay = ini_get_bool('display_errors');
}
if ($CFG->debugdisplay) {
if (!defined('DEBUGGING_PRINTED')) {