Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattpiwik <matthieu.aubry@gmail.com>2011-04-17 22:29:58 +0400
committermattpiwik <matthieu.aubry@gmail.com>2011-04-17 22:29:58 +0400
commit53f3dda7c3cbac4943bd45f426872a8ef77db01c (patch)
tree58e64e4cd5d8d05302249b5916f9f3b37a7930e6
parent58845ed5f7144650daa9d4b5d82e695f9f0e4de1 (diff)
Fixes Timezone ID '' is invalid in /homepages/4/d23401398/htdocs/typo3conf/piwik/piwik/core/Date.php on line 88
git-svn-id: http://dev.piwik.org/svn/trunk@4494 59fd770c-687e-43c8-a1e3-f5a4ff64c105
-rw-r--r--core/Date.php6
-rw-r--r--tests/core/Date.test.php5
2 files changed, 10 insertions, 1 deletions
diff --git a/core/Date.php b/core/Date.php
index 43e6a4e707..3c7962ce1e 100644
--- a/core/Date.php
+++ b/core/Date.php
@@ -79,7 +79,7 @@ class Piwik_Date
{
$date = new Piwik_Date($dateString);
}
- if(is_null($timezone))
+ if(empty($timezone))
{
return $date;
}
@@ -205,6 +205,10 @@ class Piwik_Date
*/
public function getTimestamp()
{
+ if(empty($this->timezone))
+ {
+ $this->timezone = 'UTC';
+ }
$utcOffset = self::extractUtcOffset($this->timezone);
if($utcOffset !== false) {
return (int)($this->timestamp - $utcOffset * 3600);
diff --git a/tests/core/Date.test.php b/tests/core/Date.test.php
index e80846d4ec..09a165370a 100644
--- a/tests/core/Date.test.php
+++ b/tests/core/Date.test.php
@@ -82,6 +82,11 @@ class Test_Piwik_Date extends UnitTestCase
$this->assertEqual($date->getDateStartUTC(), $dayStart);
$this->assertEqual($date->getDateEndUTC(), $dayEnd);
+ // try with empty timezone
+ $date = $date->setTimezone('');
+ $this->assertEqual($date->getDateStartUTC(), $dayStart);
+ $this->assertEqual($date->getDateEndUTC(), $dayEnd);
+
$date = $date->setTimezone('UTC');
$this->assertEqual($date->getDateStartUTC(), $dayStart);
$this->assertEqual($date->getDateEndUTC(), $dayEnd);