From 9b1b338bf87acccc049686d5e466b3e79a395282 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Sat, 11 Apr 2015 00:17:28 +0000 Subject: [PATCH] Avoid fatal error if the recurrence end date cannot be determined. --- calendar/inc/class.calendar_ical.inc.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index e625b5e3a7..f32c7ad6de 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -2965,6 +2965,15 @@ class calendar_ical extends calendar_boupdate // reset recure_enddate to 00:00:00 on the last day $rriter = calendar_rrule::event2rrule($event, false); $last = $rriter->normalize_enddate(); + if(!is_object($last)) + { + if($this->log) + { + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . + " Unable to determine recurrence end date. \n".array2string($event),3, $this->logfile); + } + return false; + } $last->setTime(0, 0, 0); //error_log(__METHOD__."() rrule=$recurence --> ".array2string($rriter)." --> enddate=".array2string($last).'='.egw_time::to($last, '')); $event['recur_enddate'] = egw_time::to($last, 'server'); @@ -2974,6 +2983,15 @@ class calendar_ical extends calendar_boupdate { $rriter = calendar_rrule::event2rrule($event, false); $last = $rriter->count2date($event['recur_count']); + if(!is_object($last)) + { + if($this->log) + { + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__, + " Unable to determine recurrence end date. \n".array2string($event),3, $this->logfile); + } + return false; + } $last->setTime(0, 0, 0); $event['recur_enddate'] = egw_time::to($last, 'server'); unset($event['recur_count']);