Skip to content
Snippets Groups Projects

Issue #3323047: Review sidebar infinite loop

Merged dpi requested to merge issue/oh-3323047:3323047-review-sidebar-infinite into 3.x
Files
2
@@ -29,25 +29,26 @@ final class OhReviewUtility {
$weekFormat = 'o-W';
$dayFormat = 'Y-m-d';
/** @var array<string, \Drupal\oh\OhOccurrence[]> $occurrencesByDay */
$occurrencesByDay = [];
if ($fillDays) {
// Fill in the days.
$fillPointer = $range->getStart();
$fillEnd = $range->getEnd();
$fillEnd->modify('-1 second');
$fillPointer = $range->period()->getStartDate();
$fillEnd = $range->period()->getEndDate();
$fillEnd = $fillEnd->modify('-1 second');
while ($fillPointer < $fillEnd) {
$pointerDay = $fillPointer->format($dayFormat);
if (!isset($occurrencesByDay[$pointerDay])) {
$occurrencesByDay[$pointerDay] = [];
}
$fillPointer->modify('+1 day');
$fillPointer = $fillPointer->modify('+1 day');
}
}
uasort($occurrences, [OhOccurrence::class, 'sort']);
foreach ($occurrences as $occurrence) {
$day = $occurrence->getStart()->format($dayFormat);
$day = $occurrence->period()->getStartDate()->format($dayFormat);
$occurrencesByDay[$day][] = $occurrence;
}
@@ -61,8 +62,8 @@ final class OhReviewUtility {
$groupedByWeek[$week][$dayCode] = $groupedByWeek[$week][$dayCode] ?? [];
}
foreach ($occurrences as $occurrence) {
$week = $occurrence->getStart()->format($weekFormat);
$day = $occurrence->getStart()->format($dayFormat);
$week = $occurrence->period()->getStartDate()->format($weekFormat);
$day = $occurrence->period()->getStartDate()->format($dayFormat);
$groupedByWeek[$week][$day][] = $occurrence;
}
}
Loading