Skip to content

Commit

Permalink
Fixed undefined index 'foo@bar.com' notices.
Browse files Browse the repository at this point in the history
  • Loading branch information
evert committed May 22, 2015
1 parent 5c0cf39 commit 8172f0e
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 1 deletion.
7 changes: 7 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
ChangeLog
=========

3.4.4 (????-??-??)
------------------

* #???: Fixed a 'party crasher' bug in the iTip broker. This would break
scheduling in some cases.


3.4.3 (2015-05-19)
------------------

Expand Down
6 changes: 5 additions & 1 deletion lib/ITip/Broker.php
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,12 @@ protected function parseEventForAttendee(VCalendar $calendar, array $eventInfo,
return array();
}

$oldInstances = !empty($oldEventInfo['attendees'][$attendee]['instances']) ?
$oldEventInfo['attendees'][$attendee]['instances'] :
array();

$instances = array();
foreach($oldEventInfo['attendees'][$attendee]['instances'] as $instance) {
foreach($oldInstances as $instance) {

$instances[$instance['id']] = array(
'id' => $instance['id'],
Expand Down
93 changes: 93 additions & 0 deletions tests/VObject/ITip/BrokerAttendeeReplyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,99 @@ function testReplyNoMasterEvent() {
ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
END:VEVENT
END:VCALENDAR
ICS

),

);

$result = $this->parse($oldMessage, $newMessage, $expected);

}

/**
* A party crasher is an attendee that accepted an event, but was not in
* any original invite.
*
* @depends testAccepted
*/
function testPartyCrasher() {

$oldMessage = <<<ICS
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
UID:foobar
SUMMARY:B-day party
SEQUENCE:1
ORGANIZER;CN=Strunk:mailto:strunk@example.org
DTSTART:20140716T120000Z
RRULE:FREQ=DAILY
END:VEVENT
BEGIN:VEVENT
UID:foobar
RECURRENCE-ID:20140717T120000Z
SUMMARY:B-day party
SEQUENCE:1
ORGANIZER;CN=Strunk:mailto:strunk@example.org
DTSTART:20140717T120000Z
RRULE:FREQ=DAILY
END:VEVENT
END:VCALENDAR
ICS;


$newMessage = <<<ICS
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
UID:foobar
SUMMARY:B-day party
SEQUENCE:1
ORGANIZER;CN=Strunk:mailto:strunk@example.org
DTSTART:20140716T120000Z
RRULE:FREQ=DAILY
END:VEVENT
BEGIN:VEVENT
UID:foobar
RECURRENCE-ID:20140717T120000Z
SUMMARY:B-day party
SEQUENCE:1
ORGANIZER;CN=Strunk:mailto:strunk@example.org
ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
DTSTART:20140717T120000Z
RRULE:FREQ=DAILY
END:VEVENT
END:VCALENDAR
ICS;

$version = \Sabre\VObject\Version::VERSION;

$expected = array(
array(
'uid' => 'foobar',
'method' => 'REPLY',
'component' => 'VEVENT',
'sender' => 'mailto:one@example.org',
'senderName' => 'One',
'recipient' => 'mailto:strunk@example.org',
'recipientName' => 'Strunk',
'message' => <<<ICS
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REPLY
BEGIN:VEVENT
UID:foobar
SEQUENCE:1
DTSTART:20140717T120000Z
SUMMARY:B-day party
RECURRENCE-ID:20140717T120000Z
ORGANIZER;CN=Strunk:mailto:strunk@example.org
ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one@example.org
END:VEVENT
END:VCALENDAR
ICS

),
Expand Down

0 comments on commit 8172f0e

Please sign in to comment.