Skip to content

Commit 12e57c3

Browse files
committed
Fixes PHP 8.1: PHP Fatal error: Uncaught TypeError: sizeof(): Argument #1
1 parent 166a868 commit 12e57c3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

functions/template.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function draw_print($template_p) {
8181
foreach ($new_val as $new_key2 => $new_val2) {
8282
if (isset($seen_events[$new_key2])) {
8383
// Include in list if we've already seen it AND
84-
// (it spans more than one day OR it's a recurring event)
84+
// (it spans more than one day OR it's a recurring event)
8585
if (($new_val2['spans_day'] != 1) && (!isset($new_val2['recur']))) {
8686
continue;
8787
}
@@ -378,7 +378,7 @@ function draw_week($template_p) {
378378
$loop_hours = trim($match2[1]);
379379
$loop_event = trim($match3[1]);
380380

381-
$event_length = array ();
381+
$event_length = array();
382382
$border = 0;
383383
preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})/', $getdate, $day_array2);
384384
$this_day = $day_array2[3];
@@ -445,7 +445,7 @@ function draw_week($template_p) {
445445
}
446446
$j++;
447447
}
448-
if ($j == sizeof(@$event_length[$thisday])) {
448+
if (empty($event_length[$thisday]) || $j == count($event_length[$thisday])) {
449449
$event_length[$thisday][] = array ('length' => ($drawEvent['draw_length'] / $phpiCal_config->gridLength), 'key' => $eventKey, 'overlap' => $loopevent['event_overlap'],'state' => 'begin');
450450
}
451451
}
@@ -1096,7 +1096,7 @@ function monthbottom() {
10961096
foreach ($event_times as $uid => $val) {
10971097
if (isset($seen_events[$uid])) {
10981098
// Include in list if we've already seen it AND
1099-
// (it spans more than one day OR it's a recurring event)
1099+
// (it spans more than one day OR it's a recurring event)
11001100
if ((@$val['spans_day'] != 1) && (!isset($val['recur']))) {
11011101
continue;
11021102
}

0 commit comments

Comments
 (0)