From cdc8454cf112006e4199b6221bcaa3c3a509b564 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sat, 12 Apr 2014 18:13:37 +0100 Subject: Update sabre --- .../vobject/lib/Sabre/VObject/TimeZoneUtil.php | 59 +++++++++++++++++++--- vendor/sabre/vobject/lib/Sabre/VObject/Version.php | 2 +- 2 files changed, 53 insertions(+), 8 deletions(-) (limited to 'vendor/sabre/vobject/lib') diff --git a/vendor/sabre/vobject/lib/Sabre/VObject/TimeZoneUtil.php b/vendor/sabre/vobject/lib/Sabre/VObject/TimeZoneUtil.php index 6f5b69f3f..c009a6af0 100644 --- a/vendor/sabre/vobject/lib/Sabre/VObject/TimeZoneUtil.php +++ b/vendor/sabre/vobject/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', ); /** @@ -408,9 +438,21 @@ class TimeZoneUtil { static public function getTimeZone($tzid, Component $vcalendar = null, $failIfUncertain = false) { // First we will just see if the tzid is a support timezone identifier. - try { - return new \DateTimeZone($tzid); - } catch (\Exception $e) { + // + // The only exception is if the timezone starts with (. This is to + // handle cases where certain microsoft products generate timezone + // identifiers that for instance look like: + // + // (GMT+01.00) Sarajevo/Warsaw/Zagreb + // + // Since PHP 5.5.10, the first bit will be used as the timezone and + // this method will return just GMT+01:00. This is wrong, because it + // doesn't take DST into account. + if ($tzid[0]!=='(') { + try { + return new \DateTimeZone($tzid); + } catch (\Exception $e) { + } } // Next, we check if the tzid is somewhere in our tzid map. @@ -420,6 +462,12 @@ class TimeZoneUtil { // Maybe the author was hyper-lazy and just included an offset. We // support it, but we aren't happy about it. + // + // Note that the path in the source will never be taken from PHP 5.5.10 + // onwards. PHP 5.5.10 supports the "GMT+0100" style of format, so it + // already gets returned early in this function. Once we drop support + // for versions under PHP 5.5.10, this bit can be taken out of the + // source. if (preg_match('/^GMT(\+|-)([0-9]{4})$/', $tzid, $matches)) { return new \DateTimeZone('Etc/GMT' . $matches[1] . ltrim(substr($matches[2],0,2),'0')); } @@ -443,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/vendor/sabre/vobject/lib/Sabre/VObject/Version.php b/vendor/sabre/vobject/lib/Sabre/VObject/Version.php index 2a64140f4..5b04d0b7a 100644 --- a/vendor/sabre/vobject/lib/Sabre/VObject/Version.php +++ b/vendor/sabre/vobject/lib/Sabre/VObject/Version.php @@ -14,7 +14,7 @@ class Version { /** * Full version number */ - const VERSION = '2.1.3'; + const VERSION = '2.1.4'; /** * Stability : alpha, beta, stable -- cgit v1.2.3