Skip to content

Commit

Permalink
Check that start or end time range keys exist
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Jan 11, 2021
1 parent ef7d410 commit b04269f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/CalDAV/Backend/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ public function calendarQuery($calendarId, array $filters)
// If start time OR the end time is not specified, we can do a
// 100% accurate mysql query.
if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['prop-filters'] && $timeRange) {
if (!$timeRange['start'] || !$timeRange['end']) {
if ((array_key_exists('start', $timeRange) && !$timeRange['start']) || (array_key_exists('end', $timeRange) && !$timeRange['end'])) {
$requirePostFilter = false;
}
}
Expand All @@ -812,11 +812,11 @@ public function calendarQuery($calendarId, array $filters)
$values['componenttype'] = $componentType;
}

if ($timeRange && $timeRange['start']) {
if ($timeRange && array_key_exists('start', $timeRange) && $timeRange['start']) {
$query .= ' AND lastoccurence > :startdate';
$values['startdate'] = $timeRange['start']->getTimeStamp();
}
if ($timeRange && $timeRange['end']) {
if ($timeRange && array_key_exists('end', $timeRange) && $timeRange['end']) {
$query .= ' AND firstoccurence < :enddate';
$values['enddate'] = $timeRange['end']->getTimeStamp();
}
Expand Down

0 comments on commit b04269f

Please sign in to comment.