plugins/libcalendaring
Aleksander Machniak
machniak at kolabsys.com
Fri Aug 30 15:00:57 CEST 2013
plugins/libcalendaring/libvcalendar.php | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
New commits:
commit 9f8c4d547eb573dc3f708d7967e2357e63123dc9
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Fri Aug 30 14:58:16 2013 +0200
Fix bug where exception was unintentionally thrown after catching it.
Fix so invalid dates in LAST-MODIFIED, DTSTAMP, CREATED fields of iCalendar import
doesn't throw exceptions (Bug #2144)
diff --git a/plugins/libcalendaring/libvcalendar.php b/plugins/libcalendaring/libvcalendar.php
index 998ed13..5776af5 100644
--- a/plugins/libcalendaring/libvcalendar.php
+++ b/plugins/libcalendaring/libvcalendar.php
@@ -108,7 +108,6 @@ class libvcalendar
return $this->import_from_vobject($vobject);
}
catch (Exception $e) {
- throw $e;
rcube::raise_error(array(
'code' => 600, 'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
@@ -206,19 +205,28 @@ class libvcalendar
$event = array(
'uid' => strval($ve->UID),
'title' => strval($ve->SUMMARY),
- 'created' => $ve->CREATED ? $ve->CREATED->getDateTime() : null,
- 'changed' => null,
'_type' => $ve->name == 'VTODO' ? 'task' : 'event',
// set defaults
'priority' => 0,
'attendees' => array(),
);
+ // Catch possible exceptions when date is invalid (Bug #2144)
+ // We can skip these fields, they aren't critical
+ if ($ve->CREATED) {
+ try {
+ $event['created'] = $ve->CREATED->getDateTime();
+ } catch (Exception $e) {};
+ }
if ($ve->{'LAST-MODIFIED'}) {
- $event['changed'] = $ve->{'LAST-MODIFIED'}->getDateTime();
+ try {
+ $event['changed'] = $ve->{'LAST-MODIFIED'}->getDateTime();
+ } catch (Exception $e) {};
}
- else if ($ve->DTSTAMP) {
- $event['changed'] = $ve->DTSTAMP->getDateTime();
+ if (!$event['changed'] && $ve->DTSTAMP) {
+ try {
+ $event['changed'] = $ve->DTSTAMP->getDateTime();
+ } catch (Exception $e) {};
}
// map other attributes to internal fields
More information about the commits
mailing list