Skip to content

Commit

Permalink
Jetpack iCalendarReader: Fix Undefined array key Warnings (#39740)
Browse files Browse the repository at this point in the history
* Jetpack iCalendarReader: Fix Undefined array key Warnings
  • Loading branch information
fgiannar authored Oct 11, 2024
1 parent 492773f commit bd3ef70
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
16 changes: 8 additions & 8 deletions projects/plugins/jetpack/_inc/lib/icalendar-reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Jetpack iCalendarReader: Fix Undefined array key Warnings


0 comments on commit bd3ef70

Please sign in to comment.