Skip to content
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
5 changes: 5 additions & 0 deletions lib/Recur/RRuleIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,11 @@ protected function parseRRule($rrule)
throw new InvalidDataException('Not supported: '.strtoupper($key));
}
}

// FREQ is mandatory
if (!isset($this->frequency)) {
throw new InvalidDataException('Unknown value for FREQ');
}
}

/**
Expand Down
11 changes: 11 additions & 0 deletions tests/VObject/Recur/RRuleIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@
use DateTimeImmutable;
use DateTimeZone;
use PHPUnit\Framework\TestCase;
use Sabre\VObject\InvalidDataException;

class RRuleIteratorTest extends TestCase
{
public function testInvalidMissingFreq()
{
$this->expectException(InvalidDataException::class);
$this->parse(
'COUNT=6;BYMONTHDAY=24;BYMONTH=1',
'2011-04-07 00:00:00',
[]
);
}

public function testHourly()
{
$this->parse(
Expand Down