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 1/5] 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(); From 612eb3fdb775fd7c2645c12ac4d18a687db0536f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20W=C3=B6ster?= Date: Fri, 10 May 2013 13:55:40 +0200 Subject: [PATCH 2/5] undo commit 1ccce67f345ca33441fe22602e11cc62a31db371 --- yii/yiic.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/yii/yiic.php b/yii/yiic.php index 3be0436..7cd0c40 100644 --- a/yii/yiic.php +++ b/yii/yiic.php @@ -7,10 +7,6 @@ * @license http://www.yiiframework.com/license/ */ -if(!ini_get('date.timezone')) { - date_default_timezone_set('UTC'); -} - defined('YII_DEBUG') or define('YII_DEBUG', true); // fcgi doesn't have STDIN defined by default From 8c6cf6158932160f668deace507715311e64bf13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20W=C3=B6ster?= Date: Sat, 11 May 2013 03:28:05 +0200 Subject: [PATCH 3/5] mod: don't use ArrayHelper to avoid loading another class during every request --- yii/base/Application.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/yii/base/Application.php b/yii/base/Application.php index 2cea627..0eed31b 100644 --- a/yii/base/Application.php +++ b/yii/base/Application.php @@ -85,9 +85,13 @@ class Application extends Module 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') ); - } + if (isset($config['timeZone'])) { + $this->setTimeZone($config['timeZone']); + unset($config['timeZone']); + } elseif (!ini_get('date.timezone')) { + $this->setTimeZone('UTC'); + unset($config['timeZone']); + } $this->registerErrorHandlers(); $this->registerCoreComponents(); From 6d46abcd88fd2a20da8546138efb29cb0e0fbb1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20W=C3=B6ster?= Date: Sat, 11 May 2013 03:36:58 +0200 Subject: [PATCH 4/5] remove fix for unset timezone from bootstrap app --- apps/bootstrap/index.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/apps/bootstrap/index.php b/apps/bootstrap/index.php index dec6e35..a0488ca 100644 --- a/apps/bootstrap/index.php +++ b/apps/bootstrap/index.php @@ -1,7 +1,4 @@ Date: Sat, 11 May 2013 03:39:19 +0200 Subject: [PATCH 5/5] fix: remove pointless unset --- yii/base/Application.php | 1 - 1 file changed, 1 deletion(-) diff --git a/yii/base/Application.php b/yii/base/Application.php index 0eed31b..80ecefb 100644 --- a/yii/base/Application.php +++ b/yii/base/Application.php @@ -90,7 +90,6 @@ class Application extends Module unset($config['timeZone']); } elseif (!ini_get('date.timezone')) { $this->setTimeZone('UTC'); - unset($config['timeZone']); } $this->registerErrorHandlers();