diff --git a/projects/plugins/jetpack/_inc/lib/icalendar-reader.php b/projects/plugins/jetpack/_inc/lib/icalendar-reader.php index 572b85c45cb3e..11b728c3a4545 100644 --- a/projects/plugins/jetpack/_inc/lib/icalendar-reader.php +++ b/projects/plugins/jetpack/_inc/lib/icalendar-reader.php @@ -147,13 +147,13 @@ public function apply_timezone_offset( $events ) { $start_time = preg_replace( '/Z$/', '', $event['DTSTART'] ); $start_time = new DateTime( $start_time, $this->timezone ); $start_time->setTimeZone( $timezone ); - - $end_time = preg_replace( '/Z$/', '', $event['DTEND'] ); - $end_time = new DateTime( $end_time, $this->timezone ); - $end_time->setTimeZone( $timezone ); - $event['DTSTART'] = $start_time->format( 'YmdHis\Z' ); - $event['DTEND'] = $end_time->format( 'YmdHis\Z' ); + if ( isset( $event['DTEND'] ) ) { + $end_time = preg_replace( '/Z$/', '', $event['DTEND'] ); + $end_time = new DateTime( $end_time, $this->timezone ); + $end_time->setTimeZone( $timezone ); + $event['DTEND'] = $end_time->format( 'YmdHis\Z' ); + } } $offsetted_events[] = $event; @@ -231,9 +231,9 @@ protected function filter_past_and_recurring_events( $events ) { // Process events with RRULE before other events. $rrule = isset( $event['RRULE'] ) ? $event['RRULE'] : false; - $uid = $event['UID']; + $uid = isset( $event['UID'] ) ? $event['UID'] : false; - if ( $rrule && ! in_array( $uid, $set_recurring_events, true ) ) { + if ( $rrule && $uid && ! in_array( $uid, $set_recurring_events, true ) ) { // Break down the RRULE into digestible chunks. $rrule_array = array(); diff --git a/projects/plugins/jetpack/changelog/fix-icalendar-reader-warnings b/projects/plugins/jetpack/changelog/fix-icalendar-reader-warnings new file mode 100644 index 0000000000000..137eb927f0deb --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-icalendar-reader-warnings @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Jetpack iCalendarReader: Fix Undefined array key Warnings + +