diff --git a/calendar/inc/class.calendar_groupdav.inc.php b/calendar/inc/class.calendar_groupdav.inc.php index 6435b69af4..53ae192b77 100644 --- a/calendar/inc/class.calendar_groupdav.inc.php +++ b/calendar/inc/class.calendar_groupdav.inc.php @@ -871,10 +871,10 @@ class calendar_groupdav extends Api\CalDAV\Handler { trim($attribute); list($key, $value) = explode('=', $attribute); - switch (strtolower($key)) + switch (strtolower(trim($key))) { case 'charset': - $charset = strtoupper(substr($value,1,-1)); + $charset = strtoupper(trim($value)); } } } @@ -1078,12 +1078,11 @@ class calendar_groupdav extends Api\CalDAV\Handler array_shift($content_type); foreach ($content_type as $attribute) { - trim($attribute); list($key, $value) = explode('=', $attribute); - switch (strtolower($key)) + switch (strtolower(trim($key))) { case 'charset': - $charset = strtoupper(substr($value,1,-1)); + $charset = strtoupper(trim($value)); } } } diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index 830645f0a2..35fe9839ff 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -3461,9 +3461,9 @@ class calendar_ical extends calendar_boupdate // sort by start datetime uasort($events, function($a, $b) { - $diff = $a['start'] < $b['start']; + $diff = $a['start'] - $b['start']; - return !$diff ? 0 : ($diff < 0 ? -1 : 1); + return $diff == 0 ? 0 : ($diff < 0 ? -1 : 1); }); $fbdata = array();