Skip to content

Commit

Permalink
Make sure that time isn't after the end date.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Feb 7, 2017
1 parent d1a00a6 commit ec55678
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions framework/Icalendar/lib/Horde/Icalendar.php
Expand Up @@ -1297,8 +1297,18 @@ function($a, $b) {
$t = @gmmktime($time['hour'], $time['minute'], $time['second'],
$date['month'], $date['mday'], $date['year']);

if ($t < $change_times[0]['time']) {
return $change_times[0]['from'];
// First check for the first change time that isn't expired (from POV of
// $time) and is after $t.
$n = count($change_times);
for ($i = 0, $n = count($change_times); $i < $n -1; $i++) {
if (!$this->_checkEndDate($t, $change_times[$i])) {
continue;
}
if ($t < $change_times[$i]['time']) {
return $change_times[$i]['from'];
} else {
break;
}
}

for ($i = 0, $n = count($change_times); $i < $n - 1; $i++) {
Expand Down

0 comments on commit ec55678

Please sign in to comment.