[feature/new-tz-handling] Fall back to UTC, if the timezone is invalid

This should avoid problems, when the board files are updated but database isn't.

PHPBB3-9558
This commit is contained in:
Joas Schilling 2012-07-19 15:46:12 +02:00
parent 6de222065e
commit 196e634370
2 changed files with 17 additions and 2 deletions

View file

@ -916,7 +916,14 @@ class acp_board
// Let the format_date function operate with the acp values
$old_tz = $user->timezone;
try
{
$user->timezone = new DateTimeZone($config['board_timezone']);
}
catch (Exception $e)
{
// If the board timezone is invalid, we just use the users timezone.
}
$dateformat_options = '';

View file

@ -127,7 +127,15 @@ class phpbb_user extends phpbb_session
*/
}
try
{
$this->timezone = new DateTimeZone($user_timezone);
}
catch (Exception $e)
{
// If the timezone the user has selected is invalid, we fall back to UTC.
$this->timezone = new DateTimeZone('UTC');
}
// We include common language file here to not load it every time a custom language file is included
$lang = &$this->lang;