aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/lib/Recur
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-10-11 18:34:03 +0000
committerMario <mario@mariovavti.com>2022-10-11 18:34:03 +0000
commit108a3efe0b6d37a7ed394a84c69b924ca727f17a (patch)
treeed9904767622d769fcee883d407310087ed7d57a /vendor/sabre/vobject/lib/Recur
parentccd826f63a7a4c7e442fab8a70d9c4c84808b417 (diff)
downloadvolse-hubzilla-108a3efe0b6d37a7ed394a84c69b924ca727f17a.tar.gz
volse-hubzilla-108a3efe0b6d37a7ed394a84c69b924ca727f17a.tar.bz2
volse-hubzilla-108a3efe0b6d37a7ed394a84c69b924ca727f17a.zip
update composer libs
Diffstat (limited to 'vendor/sabre/vobject/lib/Recur')
-rw-r--r--vendor/sabre/vobject/lib/Recur/RRuleIterator.php30
1 files changed, 26 insertions, 4 deletions
diff --git a/vendor/sabre/vobject/lib/Recur/RRuleIterator.php b/vendor/sabre/vobject/lib/Recur/RRuleIterator.php
index d556aa6c3..4f0e9070d 100644
--- a/vendor/sabre/vobject/lib/Recur/RRuleIterator.php
+++ b/vendor/sabre/vobject/lib/Recur/RRuleIterator.php
@@ -25,6 +25,13 @@ use Sabre\VObject\Property;
class RRuleIterator implements Iterator
{
/**
+ * Constant denoting the upper limit on how long into the future
+ * we want to iterate. The value is a unix timestamp and currently
+ * corresponds to the datetime 9999-12-31 11:59:59 UTC.
+ */
+ const dateUpperLimit = 253402300799;
+
+ /**
* Creates the Iterator.
*
* @param string|array $rrule
@@ -366,6 +373,12 @@ class RRuleIterator implements Iterator
// Current hour of the day
$currentHour = $this->currentDate->format('G');
+
+ if ($this->currentDate->getTimestamp() > self::dateUpperLimit) {
+ $this->currentDate = null;
+
+ return;
+ }
} while (
($this->byDay && !in_array($currentDay, $recurrenceDays)) ||
($this->byHour && !in_array($currentHour, $recurrenceHours)) ||
@@ -486,7 +499,7 @@ class RRuleIterator implements Iterator
// To prevent running this forever (better: until we hit the max date of DateTimeImmutable) we simply
// stop at 9999-12-31. Looks like the year 10000 problem is not solved in php ....
- if ($this->currentDate->getTimestamp() > 253402300799) {
+ if ($this->currentDate->getTimestamp() > self::dateUpperLimit) {
$this->currentDate = null;
return;
@@ -589,11 +602,12 @@ class RRuleIterator implements Iterator
// loop through all YearDay and Days to check all the combinations
foreach ($this->byYearDay as $byYearDay) {
$date = clone $this->currentDate;
- $date = $date->setDate($currentYear, 1, 1);
if ($byYearDay > 0) {
- $date = $date->add(new \DateInterval('P'.$byYearDay.'D'));
+ $date = $date->setDate($currentYear, 1, 1);
+ $date = $date->add(new \DateInterval('P'.($byYearDay - 1).'D'));
} else {
- $date = $date->sub(new \DateInterval('P'.abs($byYearDay).'D'));
+ $date = $date->setDate($currentYear, 12, 31);
+ $date = $date->sub(new \DateInterval('P'.abs($byYearDay + 1).'D'));
}
if ($date > $this->currentDate && in_array($date->format('N'), $dayOffsets)) {
@@ -658,6 +672,14 @@ class RRuleIterator implements Iterator
(int) $currentMonth,
(int) $currentDayOfMonth
);
+
+ // To prevent running this forever (better: until we hit the max date of DateTimeImmutable) we simply
+ // stop at 9999-12-31. Looks like the year 10000 problem is not solved in php ....
+ if ($this->currentDate->getTimestamp() > self::dateUpperLimit) {
+ $this->currentDate = null;
+
+ return;
+ }
}
// If we made it here, it means we got a valid occurrence