diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2012-07-19 15:46:12 +0200 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2012-07-19 15:46:12 +0200 |
| commit | 196e6343702e7d769d1b1668fd29682ad3bade4c (patch) | |
| tree | d169a6036e3cf4b8ece092e4c9446b7615a814b5 /phpBB/includes | |
| parent | 6de222065e737bdab4ecdd010773fb70c415fb3b (diff) | |
| download | forums-196e6343702e7d769d1b1668fd29682ad3bade4c.tar forums-196e6343702e7d769d1b1668fd29682ad3bade4c.tar.gz forums-196e6343702e7d769d1b1668fd29682ad3bade4c.tar.bz2 forums-196e6343702e7d769d1b1668fd29682ad3bade4c.tar.xz forums-196e6343702e7d769d1b1668fd29682ad3bade4c.zip | |
[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
Diffstat (limited to 'phpBB/includes')
| -rw-r--r-- | phpBB/includes/acp/acp_board.php | 9 | ||||
| -rw-r--r-- | phpBB/includes/user.php | 10 |
2 files changed, 17 insertions, 2 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 4af9d52e44..937d9e926f 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -916,7 +916,14 @@ class acp_board // Let the format_date function operate with the acp values $old_tz = $user->timezone; - $user->timezone = new DateTimeZone($config['board_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 = ''; 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; |
