diff options
author | Simon Rettberg | 2021-02-05 16:27:24 +0100 |
---|---|---|
committer | Simon Rettberg | 2021-02-05 16:27:24 +0100 |
commit | c3de1f47eaf841ac7ca14261d048623803f1d321 (patch) | |
tree | f2b53d612bd99bf2655636c63a4e00ec6234cdd2 /modules-available/locationinfo | |
parent | [statistics] Show ID45 live stats (diff) | |
download | slx-admin-c3de1f47eaf841ac7ca14261d048623803f1d321.tar.gz slx-admin-c3de1f47eaf841ac7ca14261d048623803f1d321.tar.xz slx-admin-c3de1f47eaf841ac7ca14261d048623803f1d321.zip |
[locationinfo] Fix conversion of time zone argument to DateTime
Now we properly always convert time zone strings to DateTimeZone
instances before passing them to the DateTime(Immutable) constructor
as the second argument. The timeZoneStringToDateTimeZone() was made
idempotent, to simplify code using it.
Diffstat (limited to 'modules-available/locationinfo')
-rw-r--r-- | modules-available/locationinfo/inc/icalparser.inc.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules-available/locationinfo/inc/icalparser.inc.php b/modules-available/locationinfo/inc/icalparser.inc.php index 15cd95c6..0be8777b 100644 --- a/modules-available/locationinfo/inc/icalparser.inc.php +++ b/modules-available/locationinfo/inc/icalparser.inc.php @@ -2019,7 +2019,7 @@ class ICalParser foreach (array_keys($subArray) as $key) { if ($key === 'TZID') { - $currentTimeZone = $this->timeZoneStringToDateTimeZone($subArray[$key]); + $currentTimeZone = $subArray[$key]; } elseif (is_numeric($key)) { $icalDate = $subArray[$key]; @@ -2027,7 +2027,7 @@ class ICalParser $currentTimeZone = self::TIME_ZONE_UTC; } - $output[] = new DateTimeImmutable($icalDate, $currentTimeZone); + $output[] = new DateTimeImmutable($icalDate, $this->timeZoneStringToDateTimeZone($currentTimeZone)); if ($key === $finalKey) { // Reset to default @@ -2070,6 +2070,8 @@ class ICalParser */ public function timeZoneStringToDateTimeZone($timeZoneString) { + if ($timeZoneString instanceof DateTimeZone) + return $timeZoneString; // Some time zones contain characters that are not permitted in param-texts, // but are within quoted texts. We need to remove the quotes as they're not // actually part of the time zone. |