]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add check that DateTime parameters are of correct type 18679/head
authorThomas Citharel <tcit@tcit.fr>
Sun, 5 Jan 2020 20:32:33 +0000 (21:32 +0100)
committerRoeland Jago Douma <roeland@famdouma.nl>
Sun, 22 Mar 2020 13:24:13 +0000 (14:24 +0100)
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
apps/dav/lib/CalDAV/CalDavBackend.php

index 0c71b4b386a311a9933f24c9acba4816661f139a..96459566a5a10fa971bf723d0326b40aa6631a52 100644 (file)
@@ -33,6 +33,7 @@
 
 namespace OCA\DAV\CalDAV;
 
+use DateTime;
 use OCA\DAV\Connector\Sabre\Principal;
 use OCA\DAV\DAV\Sharing\Backend;
 use OCA\DAV\DAV\Sharing\IShareable;
@@ -1551,12 +1552,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())));
                        }
@@ -2258,7 +2259,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 {