Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Calendar] Fix duplicate value #25

Merged
merged 1 commit into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}
}