Skip to content

Commit

Permalink
[Calendar] Fix duplicate value (#25)
Browse files Browse the repository at this point in the history
Co-authored-by: Ren Xie Liu <liurx41@protonmail.com>
  • Loading branch information
liurxliu and Ren Xie Liu authored Oct 4, 2021
1 parent 0380546 commit f9055e0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Parser/MimeDir.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ protected function readProperty($line)
$property['parameters'][$lastParam] = $value;
} elseif (is_array($property['parameters'][$lastParam])) {
$property['parameters'][$lastParam][] = $value;
} else {
} elseif ($property['parameters'][$lastParam] !== $value) {
$property['parameters'][$lastParam] = [
$property['parameters'][$lastParam],
$value,
Expand Down
24 changes: 24 additions & 0 deletions tests/VObject/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,4 +450,28 @@ public function testReadXMLStream()
$this->assertEquals('VCALENDAR', $result->name);
$this->assertEquals(0, count($result->children()));
}

public function testReadDuplicateValue()
{
$input = <<<ICS
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Proton Technologies//ProtonCalendar Beta//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
DTSTAMP:20210903T154413Z
DTSTART;VALUE=DATE;VALUE=DATE:20210818
DTEND;VALUE=DATE;VALUE=DATE:20210819
SUMMARY:test
UID:62c73pe43p2oqci37q4g2pu580@google.com
LOCATION:home
END:VEVENT
END:VCALENDAR
ICS;

$result = Reader::read($input);
$expected = "DTSTART;VALUE=DATE:20210818\r\n";
$this->assertSame($expected, $result->VEVENT->DTSTART->serialize());
}
}

0 comments on commit f9055e0

Please sign in to comment.