Fix "PHP Fatal error: Call to a member function setTimezone() on a

non-object" when parsing occurences of recurring events, where
'changed' date is not set (Bug #2185)
This commit is contained in:
Aleksander Machniak 2013-09-03 13:06:26 +02:00
parent 9f8c4d547e
commit ea949c7992
2 changed files with 6 additions and 2 deletions

View file

@ -1205,7 +1205,8 @@ class calendar extends rcube_plugin
'_id' => $event['calendar'] . ':' . $event['id'], // unique identifier for fullcalendar
'start' => $this->lib->adjust_timezone($event['start'])->format('c'),
'end' => $this->lib->adjust_timezone($event['end'])->format('c'),
'changed' => $this->lib->adjust_timezone($event['changed'])->format('c'),
// 'changed' might be empty for event recurrences (Bug #2185)
'changed' => $event['changed'] ? $this->lib->adjust_timezone($event['changed'])->format('c') : null,
'title' => strval($event['title']),
'description' => strval($event['description']),
'location' => strval($event['location']),

View file

@ -120,7 +120,10 @@ class libcalendaring extends rcube_plugin
else if (is_string($dt))
$dt = new DateTime($dt);
$dt->setTimezone($this->timezone);
if ($dt instanceof DateTime) {
$dt->setTimezone($this->timezone);
}
return $dt;
}