[Pkg-owncloud-commits] [php-sabre-vobject] 32/128: Throwing a more specific exception for bad BYDAY clauses.

David Prévot taffit at moszumanska.debian.org
Tue May 20 23:11:00 UTC 2014


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

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

commit 3790e7eca0f9db7e023c16a2be88ea41e335237e
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Tue Jan 21 19:06:11 2014 -0500

    Throwing a more specific exception for bad BYDAY clauses.
    
    Closes #26.
---
 ChangeLog.md                             | 2 ++
 lib/Sabre/VObject/RecurrenceIterator.php | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index dcfb0fc..da53ce2 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -12,6 +12,8 @@ ChangeLog
 * Fixed: Issue #72. RecurrenceIterator should respect timezone in the UNTIL
   clause.
 * Fixed: Issue #67. BYMONTH limit on DAILY recurrences.
+* Fixed: Issue #26. Return a more descriptive error when coming across broken
+  BYDAY rules.
 
 
 3.1.3 (2013-10-02)
diff --git a/lib/Sabre/VObject/RecurrenceIterator.php b/lib/Sabre/VObject/RecurrenceIterator.php
index 485bab7..a168da0 100644
--- a/lib/Sabre/VObject/RecurrenceIterator.php
+++ b/lib/Sabre/VObject/RecurrenceIterator.php
@@ -1043,7 +1043,7 @@ class RecurrenceIterator implements \Iterator {
 
             // Dayname will be something like 'wednesday'. Now we need to find
             // all wednesdays in this month.
-            $dayHits = array();
+            $dayHits = [];
 
             $checkDate = clone $startDate;
             $checkDate->modify('first day of this month');
@@ -1060,6 +1060,9 @@ class RecurrenceIterator implements \Iterator {
             if (strlen($day)>2) {
                 $offset = (int)substr($day,0,-2);
 
+                if ($offset===0) {
+                    throw new \InvalidArgumentException('The BYDAY clause contained a 0 offset, which is not valid in iCalendar');
+                }
                 if ($offset>0) {
                     // It is possible that the day does not exist, such as a
                     // 5th or 6th wednesday of the month.

-- 
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