fix(#203): add iCal workaround where if ORGANIZER has no parameters
Some checks failed
tests / ci (push) Has been cancelled

This commit is contained in:
Benjamin Nussbaum 2026-03-11 08:35:21 +01:00
parent 5ca028b885
commit 7301cac8ca
2 changed files with 169 additions and 1 deletions

View file

@ -25,7 +25,12 @@ class IcalResponseParser implements ResponseParser
}
try {
$this->parser->parseString($body);
// Workaround for om/icalparser v4.0.0 bug where it fails if ORGANIZER or ATTENDEE has no parameters.
// When ORGANIZER or ATTENDEE has no parameters (no semicolon after the key),
// IcalParser::parseRow returns an empty string for $middle instead of an array,
// which causes a type error in a foreach loop in IcalParser::parseString.
$normalizedBody = preg_replace('/^(ORGANIZER|ATTENDEE):/m', '$1;CN=Unknown:', $body);
$this->parser->parseString($normalizedBody);
$events = $this->parser->getEvents()->sorted()->getArrayCopy();
$windowStart = now()->subDays(7);