[Pkg-owncloud-commits] [php-sabre-vobject] 14/18: Fallbacks for missing timezones from PHP 5.5.10

David Prévot taffit at moszumanska.debian.org
Mon Mar 31 01:19:40 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch 2.1
in repository php-sabre-vobject.

commit 8d9b4c13048b81c1727e507fdfe675a646035296
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Sun Mar 30 18:42:18 2014 -0400

    Fallbacks for missing timezones from PHP 5.5.10
---
 lib/Sabre/VObject/TimeZoneUtil.php       | 35 ++++++++++++++++++++++++++++----
 tests/Sabre/VObject/TimeZoneUtilTest.php |  6 +++++-
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/lib/Sabre/VObject/TimeZoneUtil.php b/lib/Sabre/VObject/TimeZoneUtil.php
index cd94f02..c009a6a 100644
--- a/lib/Sabre/VObject/TimeZoneUtil.php
+++ b/lib/Sabre/VObject/TimeZoneUtil.php
@@ -298,6 +298,36 @@ class TimeZoneUtil {
         'Fiji'                   => 'Pacific/Fiji',
         'New Zealand'            => 'Pacific/Auckland',
         'Tonga'                  => 'Pacific/Tongatapu',
+
+        // PHP 5.5.10 failed on a few timezones that were valid before. We're
+        // normalizing them here.
+        'CST6CDT'   => 'America/Chicago',
+        'Cuba'      => 'America/Havana',
+        'Egypt'     => 'Africa/Cairo',
+        'Eire'      => 'Europe/Dublin',
+        'EST5EDT'   => 'America/New_York',
+        'Factory'   => 'UTC',
+        'GB-Eire'   => 'Europe/London',
+        'GMT0'      => 'UTC',
+        'Greenwich' => 'UTC',
+        'Hongkong'  => 'Asia/Hong_Kong',
+        'Iceland'   => 'Atlantic/Reykjavik',
+        'Iran'      => 'Asia/Tehran',
+        'Israel'    => 'Asia/Jerusalem',
+        'Jamaica'   => 'America/Jamaica',
+        'Japan'     => 'Asia/Tokyo',
+        'Kwajalein' => 'Pacific/Kwajalein',
+        'Libya'     => 'Africa/Tripoli',
+        'MST7MDT'   => 'America/Denver',
+        'Navajo'    => 'America/Denver',
+        'NZ-CHAT'   => 'Pacific/Chatham',
+        'Poland'    => 'Europe/Warsaw',
+        'Portugal'  => 'Europe/Lisbon',
+        'PST8PDT'   => 'America/Los_Angeles',
+        'Singapore' => 'Asia/Singapore',
+        'Turkey'    => 'Europe/Istanbul',
+        'Universal' => 'UTC',
+        'W-SU'      => 'Europe/Moscow',
     );
 
     /**
@@ -461,10 +491,7 @@ class TimeZoneUtil {
                             $lic = substr($lic,8);
                         }
 
-                        try {
-                            return new \DateTimeZone($lic);
-                        } catch (\Exception $e) {
-                        }
+                        return self::getTimeZone($lic, null, $failIfUncertain);
 
                     }
                     // Microsoft may add a magic number, which we also have an
diff --git a/tests/Sabre/VObject/TimeZoneUtilTest.php b/tests/Sabre/VObject/TimeZoneUtilTest.php
index 7458de1..b898e8d 100644
--- a/tests/Sabre/VObject/TimeZoneUtilTest.php
+++ b/tests/Sabre/VObject/TimeZoneUtilTest.php
@@ -294,7 +294,11 @@ END:VCALENDAR
 HI;
 
         $tz = TimeZoneUtil::getTimeZone('/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT', Reader::read($vobj), true);
-        $ex = new \DateTimeZone('EST5EDT');
+        if (version_compare(PHP_VERSION, '5.5.10', '>=')) {
+            $ex = new \DateTimeZone('America/New_York');
+        } else {
+            $ex = new \DateTimeZone('EST5EDT');
+        }
         $this->assertEquals($ex->getName(), $tz->getName());
 
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git



More information about the Pkg-owncloud-commits mailing list