Fix fatal error when parsing VEVENT without DTSTART
Such a dummy/redundant VEVENT block was found in an iTip created in Exchange 2010.
This commit is contained in:
parent
1345402bb9
commit
8f88b4b120
2 changed files with 13 additions and 1 deletions
|
@ -629,7 +629,8 @@ class libcalendaring_vcalendar implements Iterator
|
|||
$event['allday'] = !empty($event['start']->_dateonly);
|
||||
|
||||
// events may lack the DTEND property, set it to DTSTART (RFC5545 3.6.1)
|
||||
if (empty($event['end'])) {
|
||||
// Note: Missing event start date is a problem, but should not throw an error here
|
||||
if (empty($event['end']) && !empty($event['start'])) {
|
||||
$event['end'] = clone $event['start'];
|
||||
}
|
||||
// shift end-date by one day (except Thunderbird)
|
||||
|
|
|
@ -61,6 +61,17 @@ class VcalendarTest extends PHPUnit\Framework\TestCase
|
|||
$desclines = explode("\n", $event['description']);
|
||||
$this->assertEquals(4, count($desclines), "Multiline description");
|
||||
$this->assertEquals("French: Fête nationale Suisse", rtrim($desclines[1]), "UTF-8 encoding");
|
||||
|
||||
$ical->reset();
|
||||
|
||||
// An event without DTSTART should not throw an exception
|
||||
// It's a broken iTip from Exchange 2010
|
||||
$ics = file_get_contents(__DIR__ . '/resources/dummy-dupe.ics');
|
||||
$events = $ical->import($ics, 'UTF-8');
|
||||
|
||||
$this->assertEquals(1, count($events));
|
||||
$event = $events[0];
|
||||
$this->assertSame('Summary', $event['title']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue