Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -3180,6 +3180,19 @@ public function itip_event_inviteform($attrib)
) . $hidden->show();
}

/**
* Escape DateTimeImmutableObject to DateTime if necessary
*/
private function sanitize_date_time_immutable($date)
{
$dateclone = clone $date;
if (is_object($dateclone) && is_a($dateclone, 'DateTimeImmutable')) {
return DateTime::createFromImmutable($dateclone);
} else {
return $dateclone;
}
}

/**
*
*/
Expand All @@ -3189,8 +3202,8 @@ private function mail_agenda_event_row($event, $class = '')
$time = $this->gettext('all-day');
}
else {
$start = is_object($event['start']) ? clone $event['start'] : $event['start'];
$end = is_object($event['end']) ? clone $event['end'] : $event['end'];
$start = is_object($event['start']) ? $this->sanitize_date_time_immutable($event['start']) : $event['start'];
$end = is_object($event['end']) ? $this->sanitize_date_time_immutable($event['end']) : $event['end'];

$time = $this->rc->format_date($start, $this->rc->config->get('time_format'))
. ' - ' . $this->rc->format_date($end, $this->rc->config->get('time_format'));
Expand Down Expand Up @@ -3259,7 +3272,7 @@ public function mail_messagebody_html($p)
// get prepared inline UI for this event object
if ($ical_objects->method) {
$append = '';
$date_str = $this->rc->format_date(clone $event['start'], $this->rc->config->get('date_format'), empty($event['start']->_dateonly));
$date_str = $this->rc->format_date($this->sanitize_date_time_immutable($event['start']), $this->rc->config->get('date_format'), empty($event['start']->_dateonly));
$date = new DateTime($event['start']->format('Y-m-d') . ' 12:00:00', new DateTimeZone('UTC'));

// prepare a small agenda preview to be filled with actual event data on async request
Expand Down