Skip to content

Commit d1f8aba

Browse files
authored
Merge pull request #740 from phil-davis/backport-723-4.5
[4.5] Issue-722: Fixing problem with broker adding exdate property with floating timezone
2 parents 777f97c + 0ddd4bc commit d1f8aba

File tree

2 files changed

+183
-2
lines changed

2 files changed

+183
-2
lines changed

lib/ITip/Broker.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,9 @@ protected function parseEventForOrganizer(VCalendar $calendar, array $eventInfo,
586586
));
587587
} else {
588588
$currentEvent->EXDATE = $exceptions;
589+
if ($currentEvent->DTSTART['TZID']) {
590+
$currentEvent->EXDATE['TZID'] = clone $currentEvent->DTSTART['TZID'];
591+
}
589592
}
590593
}
591594

tests/VObject/ITip/BrokerUpdateEventTest.php

Lines changed: 180 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,6 @@ public function testNoAttendees()
282282
END:VCALENDAR
283283
ICS;
284284

285-
$version = \Sabre\VObject\Version::VERSION;
286-
287285
$expected = [];
288286
$this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
289287
}
@@ -876,4 +874,184 @@ public function testInviteStatusCancelled(): void
876874

877875
$this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
878876
}
877+
878+
/*
879+
* When EXDATE is added by Broker, it needs to be in the correct
880+
* timezone
881+
*/
882+
883+
public function testExdateTimezone(): void
884+
{
885+
$oldMessage = <<<ICS
886+
BEGIN:VCALENDAR
887+
VERSION:2.0
888+
BEGIN:VEVENT
889+
UID:foobar
890+
SEQUENCE:1
891+
SUMMARY:foo
892+
RRULE:FREQ=WEEKLY
893+
ORGANIZER;CN=Strunk:mailto:strunk@example.org
894+
ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
895+
ATTENDEE;CN=One:mailto:one@example.org
896+
DTSTART;TZID=Europe/London:20140716T120000
897+
DTEND;TZID=Europe/London:20140716T130000
898+
END:VEVENT
899+
END:VCALENDAR
900+
ICS;
901+
902+
$newMessage = <<<ICS
903+
BEGIN:VCALENDAR
904+
VERSION:2.0
905+
BEGIN:VEVENT
906+
UID:foobar
907+
SEQUENCE:1
908+
SUMMARY:foo
909+
RRULE:FREQ=WEEKLY
910+
ORGANIZER;CN=Strunk:mailto:strunk@example.org
911+
ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
912+
ATTENDEE;CN=One:mailto:one@example.org
913+
DTSTART;TZID=Europe/London:20140716T120000
914+
DTEND;TZID=Europe/London:20140716T130000
915+
END:VEVENT
916+
BEGIN:VEVENT
917+
UID:foobar
918+
SEQUENCE:1
919+
SUMMARY:foo
920+
RECURRENCE-ID;TZID=Europe/London:20140723T120000
921+
ORGANIZER;CN=Strunk:mailto:strunk@example.org
922+
ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
923+
DTSTART;TZID=Europe/London:20140723T120000
924+
DTEND;TZID=Europe/London:20140723T130000
925+
END:VEVENT
926+
END:VCALENDAR
927+
ICS;
928+
929+
$version = \Sabre\VObject\Version::VERSION;
930+
931+
$expected = [
932+
[
933+
'uid' => 'foobar',
934+
'method' => 'REQUEST',
935+
'component' => 'VEVENT',
936+
'sender' => 'mailto:strunk@example.org',
937+
'senderName' => 'Strunk',
938+
'recipient' => 'mailto:one@example.org',
939+
'recipientName' => 'One',
940+
'significantChange' => true,
941+
'message' => <<<ICS
942+
BEGIN:VCALENDAR
943+
VERSION:2.0
944+
PRODID:-//Sabre//Sabre VObject $version//EN
945+
CALSCALE:GREGORIAN
946+
METHOD:REQUEST
947+
BEGIN:VEVENT
948+
UID:foobar
949+
SEQUENCE:1
950+
SUMMARY:foo
951+
RRULE:FREQ=WEEKLY
952+
ORGANIZER;CN=Strunk:mailto:strunk@example.org
953+
ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
954+
ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
955+
DTSTART;TZID=Europe/London:20140716T120000
956+
DTEND;TZID=Europe/London:20140716T130000
957+
EXDATE;TZID=Europe/London:20140723T120000
958+
DTSTAMP:**ANY**
959+
END:VEVENT
960+
END:VCALENDAR
961+
ICS
962+
],
963+
];
964+
965+
$this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
966+
}
967+
968+
/*
969+
* When EXDATE is added by Broker, it needs to be in the correct
970+
* timezone, also in case UTC is used
971+
*/
972+
973+
public function testExdateTimezoneUTC(): void
974+
{
975+
$oldMessage = <<<ICS
976+
BEGIN:VCALENDAR
977+
VERSION:2.0
978+
BEGIN:VEVENT
979+
UID:foobar
980+
SEQUENCE:1
981+
SUMMARY:foo
982+
RRULE:FREQ=WEEKLY
983+
ORGANIZER;CN=Strunk:mailto:strunk@example.org
984+
ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
985+
ATTENDEE;CN=One:mailto:one@example.org
986+
DTSTART:20140716T120000Z
987+
DTEND:20140716T130000Z
988+
END:VEVENT
989+
END:VCALENDAR
990+
ICS;
991+
992+
$newMessage = <<<ICS
993+
BEGIN:VCALENDAR
994+
VERSION:2.0
995+
BEGIN:VEVENT
996+
UID:foobar
997+
SEQUENCE:1
998+
SUMMARY:foo
999+
RRULE:FREQ=WEEKLY
1000+
ORGANIZER;CN=Strunk:mailto:strunk@example.org
1001+
ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
1002+
ATTENDEE;CN=One:mailto:one@example.org
1003+
DTSTART:20140716T120000Z
1004+
DTEND:20140716T130000Z
1005+
END:VEVENT
1006+
BEGIN:VEVENT
1007+
UID:foobar
1008+
SEQUENCE:1
1009+
SUMMARY:foo
1010+
RECURRENCE-ID:20140723T120000Z
1011+
ORGANIZER;CN=Strunk:mailto:strunk@example.org
1012+
ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
1013+
DTSTART:20140723T120000Z
1014+
DTEND:20140723T130000Z
1015+
END:VEVENT
1016+
END:VCALENDAR
1017+
ICS;
1018+
1019+
$version = \Sabre\VObject\Version::VERSION;
1020+
1021+
$expected = [
1022+
[
1023+
'uid' => 'foobar',
1024+
'method' => 'REQUEST',
1025+
'component' => 'VEVENT',
1026+
'sender' => 'mailto:strunk@example.org',
1027+
'senderName' => 'Strunk',
1028+
'recipient' => 'mailto:one@example.org',
1029+
'recipientName' => 'One',
1030+
'significantChange' => true,
1031+
'message' => <<<ICS
1032+
BEGIN:VCALENDAR
1033+
VERSION:2.0
1034+
PRODID:-//Sabre//Sabre VObject $version//EN
1035+
CALSCALE:GREGORIAN
1036+
METHOD:REQUEST
1037+
BEGIN:VEVENT
1038+
UID:foobar
1039+
SEQUENCE:1
1040+
SUMMARY:foo
1041+
RRULE:FREQ=WEEKLY
1042+
ORGANIZER;CN=Strunk:mailto:strunk@example.org
1043+
ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
1044+
ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
1045+
DTSTART:20140716T120000Z
1046+
DTEND:20140716T130000Z
1047+
EXDATE:20140723T120000Z
1048+
DTSTAMP:**ANY**
1049+
END:VEVENT
1050+
END:VCALENDAR
1051+
ICS
1052+
],
1053+
];
1054+
1055+
$this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
1056+
}
8791057
}

0 commit comments

Comments
 (0)