From: Michael J. Rubinsky Date: Fri, 14 Aug 2009 22:21:24 +0000 (-0400) Subject: Catch exceptions from the contacts/getFields call X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=44dbd7abb8dfa3815ef26950d6c9c079e3a04fe4;p=horde.git Catch exceptions from the contacts/getFields call Not seeing notifications about no freebusy url still, but at least it's not fataling now --- diff --git a/kronolith/lib/FreeBusy.php b/kronolith/lib/FreeBusy.php index 925640edb..27ffc9037 100644 --- a/kronolith/lib/FreeBusy.php +++ b/kronolith/lib/FreeBusy.php @@ -146,12 +146,8 @@ class Kronolith_FreeBusy { /* Check if we can retrieve a VFB from the Free/Busy URL, if one is * set. */ $url = Kronolith_FreeBusy::getUrl($email); - if (is_a($url, 'PEAR_Error')) { - $url = null; - } else { - $url = trim($url); - } if ($url) { + $url = trim($url); $options['method'] = 'GET'; $options['timeout'] = 5; $options['allowRedirects'] = true; @@ -222,15 +218,18 @@ class Kronolith_FreeBusy { * @param string $email The email address to look for. * * @return mixed The url on success or false on failure. - * @throws Horde_Exception */ function getUrl($email) { $sources = $GLOBALS['prefs']->getValue('search_sources'); $sources = empty($sources) ? array() : explode("\t", $sources); - $result = $GLOBALS['registry']->call('contacts/getField', - array($email, 'freebusyUrl', $sources, true, true)); + try { + $result = $GLOBALS['registry']->call('contacts/getField', + array($email, 'freebusyUrl', $sources, true, true)); + } catch (Horde_Exception $e) { + return false; + } if (is_array($result)) { return array_shift($result); }