Browse Source

better have timezone fix in application

app is resposible for setting time zone, so it should also do the
fixing.
+ documentation about the behavior.
issue #210 and #209
tags/2.0.0-beta
Carsten Brandt 12 years ago
parent
commit
b005b087b4
  1. 3
      apps/bootstrap/index.php
  2. 6
      yii/base/Application.php
  3. 4
      yii/yiic.php

3
apps/bootstrap/index.php

@ -1,7 +1,4 @@
<?php <?php
if(!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
}
// comment out the following line to disable debug mode // comment out the following line to disable debug mode
defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_DEBUG') or define('YII_DEBUG', true);

6
yii/base/Application.php

@ -85,6 +85,10 @@ class Application extends Module
throw new InvalidConfigException('The "basePath" configuration is required.'); throw new InvalidConfigException('The "basePath" configuration is required.');
} }
if (!ini_get('date.timezone')) {
$this->setTimeZone('UTC');
}
$this->registerErrorHandlers(); $this->registerErrorHandlers();
$this->registerCoreComponents(); $this->registerCoreComponents();
@ -222,6 +226,8 @@ class Application extends Module
/** /**
* Returns the time zone used by this application. * Returns the time zone used by this application.
* This is a simple wrapper of PHP function date_default_timezone_get(). * This is a simple wrapper of PHP function date_default_timezone_get().
* If time zone is not configured in php.ini or application config,
* it will be set to UTC by default.
* @return string the time zone used by this application. * @return string the time zone used by this application.
* @see http://php.net/manual/en/function.date-default-timezone-get.php * @see http://php.net/manual/en/function.date-default-timezone-get.php
*/ */

4
yii/yiic.php

@ -7,10 +7,6 @@
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
if(!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
}
defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_DEBUG') or define('YII_DEBUG', true);
// fcgi doesn't have STDIN defined by default // fcgi doesn't have STDIN defined by default

Loading…
Cancel
Save