[Pkg-owncloud-commits] [php-sabre-vobject] 15/128: workaround DateTime->modify() always advancing the date even if the current day is a in hhvm

David Prévot taffit at moszumanska.debian.org
Tue May 20 23:10:58 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 7637b798f1114393690f78dc8d5d3d5705879bac
Author: Robin Appelman <icewind at owncloud.com>
Date:   Tue Dec 31 18:32:46 2013 +0100

    workaround DateTime->modify() always advancing the date even if the current day is a  in hhvm
---
 lib/Sabre/VObject/RecurrenceIterator.php | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/Sabre/VObject/RecurrenceIterator.php b/lib/Sabre/VObject/RecurrenceIterator.php
index 6a267cc..62d92b4 100644
--- a/lib/Sabre/VObject/RecurrenceIterator.php
+++ b/lib/Sabre/VObject/RecurrenceIterator.php
@@ -892,7 +892,7 @@ class RecurrenceIterator implements \Iterator {
             // If we made it all the way here, it means there were no
             // valid occurrences, and we need to advance to the next
             // month.
-            $this->currentDate->modify('first day of this month');
+            $this->currentDate = new \DateTime($this->currentDate->format('Y-m-1'));
             $this->currentDate->modify('+ ' . $this->interval . ' months');
 
             // This goes to 0 because we need to start counting at hte
@@ -1035,12 +1035,17 @@ class RecurrenceIterator implements \Iterator {
 
             $dayName = $this->dayNames[$this->dayMap[substr($day,-2)]];
 
+
             // Dayname will be something like 'wednesday'. Now we need to find
             // all wednesdays in this month.
             $dayHits = array();
 
+            // workaround for missing 'first day of the month' support in hhvm
             $checkDate = new \DateTime($startDate->format('Y-m-1'));
-            $checkDate->modify($dayName);
+            // workaround modify always advancing the date even if the current day is a $dayName in hhvm
+            if ($checkDate->format('l') !== $dayName) {
+                $checkDate->modify($dayName);
+            }
 
             do {
                 $dayHits[] = $checkDate->format('j');

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