From b8ad3567e44f818d7b45f20bf1ebdfa274f90dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20W=C3=B6ster?= Date: Fri, 10 May 2013 13:49:42 +0200 Subject: [PATCH] set application timezone early in application constructor, set default of UTC if no timezone is configured at all (not in app config nor in php.ini) --- yii/base/Application.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yii/base/Application.php b/yii/base/Application.php index ac7cc6a..2cea627 100644 --- a/yii/base/Application.php +++ b/yii/base/Application.php @@ -84,6 +84,10 @@ class Application extends Module } else { throw new InvalidConfigException('The "basePath" configuration is required.'); } + + if (isset($config['timeZone']) || !ini_get('date.timezone')) { + $this->setTimeZone( \yii\helpers\ArrayHelper::remove($config,'timeZone','UTC') ); + } $this->registerErrorHandlers(); $this->registerCoreComponents();