diff options
Diffstat (limited to 'vendor/sabre/vobject/lib/Property/ICalendar/Recur.php')
-rw-r--r-- | vendor/sabre/vobject/lib/Property/ICalendar/Recur.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/Recur.php b/vendor/sabre/vobject/lib/Property/ICalendar/Recur.php index 8392a5cc1..434b77088 100644 --- a/vendor/sabre/vobject/lib/Property/ICalendar/Recur.php +++ b/vendor/sabre/vobject/lib/Property/ICalendar/Recur.php @@ -287,6 +287,54 @@ class Recur extends Property { } } } + // if there is no valid entry left, remove the whole value + if (is_array($value) && empty($values[$key])) { + unset($values[$key]); + } + } elseif ($key == 'BYWEEKNO') { + $byWeekNo = (array)$value; + foreach ($byWeekNo as $i => $v) { + if (!is_numeric($v) || (int)$v < -53 || (int)$v == 0 || (int)$v > 53) { + $warnings[] = [ + 'level' => $repair ? 1 : 3, + 'message' => 'BYWEEKNO in RRULE must have value(s) from -53 to -1, or 1 to 53!', + 'node' => $this + ]; + if ($repair) { + if (is_array($value)) { + unset($values[$key][$i]); + } else { + unset($values[$key]); + } + } + } + } + // if there is no valid entry left, remove the whole value + if (is_array($value) && empty($values[$key])) { + unset($values[$key]); + } + } elseif ($key == 'BYYEARDAY') { + $byYearDay = (array)$value; + foreach ($byYearDay as $i => $v) { + if (!is_numeric($v) || (int)$v < -366 || (int)$v == 0 || (int)$v > 366) { + $warnings[] = [ + 'level' => $repair ? 1 : 3, + 'message' => 'BYYEARDAY in RRULE must have value(s) from -366 to -1, or 1 to 366!', + 'node' => $this + ]; + if ($repair) { + if (is_array($value)) { + unset($values[$key][$i]); + } else { + unset($values[$key]); + } + } + } + } + // if there is no valid entry left, remove the whole value + if (is_array($value) && empty($values[$key])) { + unset($values[$key]); + } } } |