From 4b9d1ca97b3252a4223d12b1bce356e4ebaf7011 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sun, 5 Jan 2020 21:32:33 +0100 Subject: [PATCH] Add check that DateTime parameters are of correct type Signed-off-by: Thomas Citharel --- apps/dav/lib/CalDAV/CalDavBackend.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 38faeabbde3..3fcb97f98b7 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -33,6 +33,7 @@ namespace OCA\DAV\CalDAV; +use DateTime; use OCA\DAV\DAV\Sharing\IShareable; use OCP\DB\QueryBuilder\IQueryBuilder; use OCA\DAV\Connector\Sabre\Principal; @@ -445,7 +446,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription return $this->userDisplayNames[$uid]; } - + /** * @return array */ @@ -1550,12 +1551,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->from('calendarobjects', 'c'); if (isset($options['timerange'])) { - if (isset($options['timerange']['start'])) { + if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTime) { $outerQuery->andWhere($outerQuery->expr()->gt('lastoccurence', $outerQuery->createNamedParameter($options['timerange']['start']->getTimeStamp()))); } - if (isset($options['timerange']['end'])) { + if (isset($options['timerange']['end']) && $options['timerange']['end'] instanceof DateTime) { $outerQuery->andWhere($outerQuery->expr()->lt('firstoccurence', $outerQuery->createNamedParameter($options['timerange']['end']->getTimeStamp()))); } @@ -2257,7 +2258,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } } else { $it = new EventIterator($vObject, (string)$component->UID); - $maxDate = new \DateTime(self::MAX_DATE); + $maxDate = new DateTime(self::MAX_DATE); if ($it->isInfinite()) { $lastOccurrence = $maxDate->getTimestamp(); } else { -- 2.39.5