MDL-25314 improved prevention of output buffering + detection of misconfigured servers
Scripts that do not want buffered output just define NO_OUTPUT_BUFFERING before including config.php. The fileserving code now checks if the headers are already sent which detects misconfigured servers.
This commit is contained in:
@@ -113,6 +113,11 @@ if (!defined('NO_DEBUG_DISPLAY')) {
|
||||
define('NO_DEBUG_DISPLAY', false);
|
||||
}
|
||||
|
||||
// Some scripts such as upgrade may want to prevent output buffering
|
||||
if (!defined('NO_OUTPUT_BUFFERING')) {
|
||||
define('NO_OUTPUT_BUFFERING', false);
|
||||
}
|
||||
|
||||
// Servers should define a default timezone in php.ini, but if they don't then make sure something is defined.
|
||||
// This is a quick hack. Ideally we should ask the admin for a value. See MDL-22625 for more on this.
|
||||
if (function_exists('date_default_timezone_set') and function_exists('date_default_timezone_get')) {
|
||||
@@ -339,6 +344,10 @@ $CFG->httpswwwroot = $CFG->wwwroot;
|
||||
|
||||
require_once($CFG->libdir .'/setuplib.php'); // Functions that MUST be loaded first
|
||||
|
||||
if (NO_OUTPUT_BUFFERING) {
|
||||
disable_output_buffering();
|
||||
}
|
||||
|
||||
// Increase memory limits if possible
|
||||
raise_memory_limit(MEMORY_STANDARD);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user