diff options
Diffstat (limited to 'vendor/sabre/vobject')
6 files changed, 78 insertions, 12 deletions
diff --git a/vendor/sabre/vobject/.travis.yml b/vendor/sabre/vobject/.travis.yml index 6bf8b7592..5bd15086d 100644 --- a/vendor/sabre/vobject/.travis.yml +++ b/vendor/sabre/vobject/.travis.yml @@ -3,6 +3,14 @@ php: - 5.3 - 5.4 - 5.5 + - 5.5.9 + - 5.5.10 + - 5.6 + +matrix: + allow_failures: + - php: 5.5.10 + - php: 5.6 script: phpunit --configuration tests/phpunit.xml diff --git a/vendor/sabre/vobject/ChangeLog b/vendor/sabre/vobject/ChangeLog index 616c7ce26..96e1fb669 100644 --- a/vendor/sabre/vobject/ChangeLog +++ b/vendor/sabre/vobject/ChangeLog @@ -1,3 +1,7 @@ +2.1.4-stable (2014-03-30) + * Fixed: Issue #87: Several compatibility fixes related to timezone + handling changes in PHP 5.5.10. + 2.1.3-stable (2013-10-02) * Fixed: Issue #55. \r must be stripped from property values. * Fixed: Issue #65. Putting quotes around parameter values that contain a 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 diff --git a/vendor/sabre/vobject/tests/Sabre/VObject/RecurrenceIteratorTest.php b/vendor/sabre/vobject/tests/Sabre/VObject/RecurrenceIteratorTest.php index 1811d8b6f..5988f16e2 100644 --- a/vendor/sabre/vobject/tests/Sabre/VObject/RecurrenceIteratorTest.php +++ b/vendor/sabre/vobject/tests/Sabre/VObject/RecurrenceIteratorTest.php @@ -1291,7 +1291,7 @@ class RecurrenceIteratorTest extends \PHPUnit_Framework_TestCase { } - $tz = new DateTimeZone('GMT'); + $tz = new DateTimeZone('UTC'); $this->assertEquals(array( new DateTime('2012-01-07 12:00:00',$tz), new DateTime('2012-01-08 12:00:00',$tz), @@ -1356,7 +1356,7 @@ class RecurrenceIteratorTest extends \PHPUnit_Framework_TestCase { } - $tz = new DateTimeZone('GMT'); + $tz = new DateTimeZone('UTC'); $this->assertEquals(array( new DateTime('2012-01-12 12:00:00',$tz), new DateTime('2012-01-13 12:00:00',$tz), diff --git a/vendor/sabre/vobject/tests/Sabre/VObject/TimeZoneUtilTest.php b/vendor/sabre/vobject/tests/Sabre/VObject/TimeZoneUtilTest.php index 7f76353d2..b898e8d26 100644 --- a/vendor/sabre/vobject/tests/Sabre/VObject/TimeZoneUtilTest.php +++ b/vendor/sabre/vobject/tests/Sabre/VObject/TimeZoneUtilTest.php @@ -144,7 +144,12 @@ HI; function testTimezoneOffset() { $tz = TimeZoneUtil::getTimeZone('GMT-0400', null, true); - $ex = new \DateTimeZone('Etc/GMT-4'); + + if (version_compare(PHP_VERSION, '5.5.10', '>=')) { + $ex = new \DateTimeZone('-04:00'); + } else { + $ex = new \DateTimeZone('Etc/GMT-4'); + } $this->assertEquals($ex->getName(), $tz->getName()); } @@ -289,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()); } |