Skip to content

Commit 4b9d1ca

Browse files
committed
Add check that DateTime parameters are of correct type
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
1 parent 0676ea8 commit 4b9d1ca

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

apps/dav/lib/CalDAV/CalDavBackend.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
namespace OCA\DAV\CalDAV;
3535

36+
use DateTime;
3637
use OCA\DAV\DAV\Sharing\IShareable;
3738
use OCP\DB\QueryBuilder\IQueryBuilder;
3839
use OCA\DAV\Connector\Sabre\Principal;
@@ -445,7 +446,7 @@ private function getUserDisplayName($uid) {
445446

446447
return $this->userDisplayNames[$uid];
447448
}
448-
449+
449450
/**
450451
* @return array
451452
*/
@@ -1550,12 +1551,12 @@ public function search(array $calendarInfo, $pattern, array $searchProperties,
15501551
->from('calendarobjects', 'c');
15511552

15521553
if (isset($options['timerange'])) {
1553-
if (isset($options['timerange']['start'])) {
1554+
if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTime) {
15541555
$outerQuery->andWhere($outerQuery->expr()->gt('lastoccurence',
15551556
$outerQuery->createNamedParameter($options['timerange']['start']->getTimeStamp())));
15561557

15571558
}
1558-
if (isset($options['timerange']['end'])) {
1559+
if (isset($options['timerange']['end']) && $options['timerange']['end'] instanceof DateTime) {
15591560
$outerQuery->andWhere($outerQuery->expr()->lt('firstoccurence',
15601561
$outerQuery->createNamedParameter($options['timerange']['end']->getTimeStamp())));
15611562
}
@@ -2257,7 +2258,7 @@ public function getDenormalizedData($calendarData) {
22572258
}
22582259
} else {
22592260
$it = new EventIterator($vObject, (string)$component->UID);
2260-
$maxDate = new \DateTime(self::MAX_DATE);
2261+
$maxDate = new DateTime(self::MAX_DATE);
22612262
if ($it->isInfinite()) {
22622263
$lastOccurrence = $maxDate->getTimestamp();
22632264
} else {

0 commit comments

Comments
 (0)