From 44dbd7abb8dfa3815ef26950d6c9c079e3a04fe4 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Fri, 14 Aug 2009 18:21:24 -0400 Subject: [PATCH] Catch exceptions from the contacts/getFields call Not seeing notifications about no freebusy url still, but at least it's not fataling now --- kronolith/lib/FreeBusy.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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); } -- 2.11.0