diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 157535ec7b..e303020fd0 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -222,6 +222,7 @@ p a {
[Fix] Display php information page with the correct direction (Bug #12557)
[Fix] Increased the number of style objects (styles, templates, themes and imagesets) possible from 127 to 65535 for MySQL (Bug #13179)
[Fix] Although theoretically impossible in our code, removed the chance of trying to open a file that does not exist (Bug #13327)
+ [Fix] Although theoretically impossible in our code, changed the handling of non-existent language files.(Bug #13329, Bug #13331)
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 9a98f442d4..1956695e3a 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -303,7 +303,8 @@ class session
$this->data['is_registered'] = ($this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == USER_NORMAL || $this->data['user_type'] == USER_FOUNDER)) ? true : false;
$this->data['is_bot'] = (!$this->data['is_registered'] && $this->data['user_id'] != ANONYMOUS) ? true : false;
-
+ $this->data['user_lang'] = basename($this->data['user_lang']);
+
return true;
}
}
@@ -1208,8 +1209,8 @@ class user extends session
if ($this->data['user_id'] != ANONYMOUS)
{
- $this->lang_name = (file_exists($phpbb_root_path . 'language/' . $this->data['user_lang'] . "/common.$phpEx")) ? $this->data['user_lang'] : $config['default_lang'];
- $this->lang_path = $phpbb_root_path . 'language/' . basename($this->lang_name) . '/';
+ $this->lang_name = (file_exists($phpbb_root_path . 'language/' . $this->data['user_lang'] . "/common.$phpEx")) ? $this->data['user_lang'] : basename($config['default_lang']);
+ $this->lang_path = $phpbb_root_path . 'language/' . $this->lang_name . '/';
$this->date_format = $this->data['user_dateformat'];
$this->timezone = $this->data['user_timezone'] * 3600;
@@ -1217,8 +1218,8 @@ class user extends session
}
else
{
- $this->lang_name = $config['default_lang'];
- $this->lang_path = $phpbb_root_path . 'language/' . basename($this->lang_name) . '/';
+ $this->lang_name = basename($config['default_lang']);
+ $this->lang_path = $phpbb_root_path . 'language/' . $this->lang_name . '/';
$this->date_format = $config['default_dateformat'];
$this->timezone = $config['board_timezone'] * 3600;
$this->dst = $config['board_dst'] * 3600;
@@ -1261,12 +1262,13 @@ class user extends session
}
*/
}
-
+
// We include common language file here to not load it every time a custom language file is included
$lang = &$this->lang;
- if ((include $this->lang_path . "common.$phpEx") === false)
+
+ if ((@include $this->lang_path . "common.$phpEx") === false)
{
- die("Language file " . $this->lang_path . "common.$phpEx" . " couldn't be opened.");
+ die('Language file ' . $this->lang_name . "/common.$phpEx" . " couldn't be opened.");
}
$this->add_lang($lang_set);
@@ -1645,9 +1647,9 @@ class user extends session
$language_filename = $this->lang_path . (($use_help) ? 'help_' : '') . $lang_file . '.' . $phpEx;
}
- if ((include($language_filename)) === false)
+ if ((@include $language_filename) === false)
{
- trigger_error("Language file $language_filename couldn't be opened.", E_USER_ERROR);
+ trigger_error('Language file ' . basename($language_filename) . ' couldn\'t be opened.', E_USER_ERROR);
}
}
else if ($use_db)