[Pkg-owncloud-commits] [php-sabre-vobject] 02/08: Handle NoInstancesException in isInTimeRange()

David Prévot taffit at moszumanska.debian.org
Sat Sep 5 15:23:42 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch 3
in repository php-sabre-vobject.

commit f04cafb4eb098109b178c2ba6cb636c28e4de357
Author: Dominik Tobschall <dominik at fruux.com>
Date:   Wed Aug 26 14:05:32 2015 +0200

    Handle NoInstancesException in isInTimeRange()
    
    Conflicts:
    	lib/Component/VEvent.php
---
 lib/Component/VEvent.php | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lib/Component/VEvent.php b/lib/Component/VEvent.php
index a1b4fe2..d756919 100644
--- a/lib/Component/VEvent.php
+++ b/lib/Component/VEvent.php
@@ -4,6 +4,7 @@ namespace Sabre\VObject\Component;
 
 use Sabre\VObject;
 use Sabre\VObject\Recur\EventIterator;
+use Sabre\VObject\Recur\NoInstancesException;
 
 /**
  * VEvent component
@@ -30,7 +31,19 @@ class VEvent extends VObject\Component {
     public function isInTimeRange(\DateTime $start, \DateTime $end) {
 
         if ($this->RRULE) {
-            $it = new EventIterator($this);
+
+            try {
+
+                $it = new EventIterator($this, null, $start->getTimezone());
+
+            } catch (NoInstancesException $e) {
+
+                // If we've catched this exception, there are no instances
+                // for the event that fall into the specified time-range.
+                return false;
+
+            }
+
             $it->fastForward($start);
 
             // We fast-forwarded to a spot where the end-time of the

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git



More information about the Pkg-owncloud-commits mailing list