[Pkg-owncloud-commits] [php-sabre-vobject] 06/18: First fix for #87.
David Prévot
taffit at moszumanska.debian.org
Mon Mar 31 01:19:39 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 9109e820fe4d6872bf57aa09b61ca189ca9a1d00
Author: Evert Pot <evert at rooftopsolutions.nl>
Date: Sun Mar 30 16:25:46 2014 -0400
First fix for #87.
---
lib/Sabre/VObject/TimeZoneUtil.php | 6 ++++++
tests/Sabre/VObject/TimeZoneUtilTest.php | 7 ++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/lib/Sabre/VObject/TimeZoneUtil.php b/lib/Sabre/VObject/TimeZoneUtil.php
index 6f5b69f..b00750d 100644
--- a/lib/Sabre/VObject/TimeZoneUtil.php
+++ b/lib/Sabre/VObject/TimeZoneUtil.php
@@ -420,6 +420,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'));
}
diff --git a/tests/Sabre/VObject/TimeZoneUtilTest.php b/tests/Sabre/VObject/TimeZoneUtilTest.php
index 7f76353..7458de1 100644
--- a/tests/Sabre/VObject/TimeZoneUtilTest.php
+++ b/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());
}
--
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