Commit 9ca6bb55 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Reset the site language immediately after config is loaded (bug #787123)



Because the $lang variable is declared as static in current_language(), a
call to get_string in the sanity checks can set the language for the
entire request, even before the site language has been read in from the
config table.  This ensures the language is reset immediately after config
has been read.

Change-Id: Ic81dfaedd70de75d93a6d38dd89915eeabcccd6e
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent cf8cb98a
......@@ -926,7 +926,13 @@ function print_object($mixed) {
function current_language($reset=null) {
global $USER, $CFG, $SESSION;
static $lang;
static $lang, $cfglang;
if (!isset($cfglang) && isset($CFG->lang) && !empty($CFG->lang) && is_null($reset)) {
// This is the first call to current_language after load_config, so ensure the
// language is reset.
$reset = $cfglang = $CFG->lang;
}
if (!empty($reset)) {
$lang = $reset; // Set the language for this request
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment