From 196e6343702e7d769d1b1668fd29682ad3bade4c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Jul 2012 15:46:12 +0200 Subject: [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 --- phpBB/includes/user.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/user.php') diff --git a/phpBB/includes/user.php b/phpBB/includes/user.php index 48c328214d..fcbfaaddfa 100644 --- a/phpBB/includes/user.php +++ b/phpBB/includes/user.php @@ -127,7 +127,15 @@ class phpbb_user extends phpbb_session */ } - $this->timezone = new DateTimeZone($user_timezone); + 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; -- cgit v1.2.1