From: Michael M Slusarz Date: Tue, 7 Sep 2010 06:12:16 +0000 (-0600) Subject: Catch IMAP caching init errors X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=bf7f62efcc6ed5f62bca1464fc0452f8d9e65b0e;p=horde.git Catch IMAP caching init errors --- diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Base.php b/framework/Imap_Client/lib/Horde/Imap/Client/Base.php index a94b276ca..bf61c7f79 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Base.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Base.php @@ -233,7 +233,6 @@ abstract class Horde_Imap_Client_Base implements Serializable * mailbox. * * @return boolean Returns true if caching is enabled. - * @throws Horde_Imap_Client_Exception */ protected function _initCache($current = false) { @@ -244,12 +243,16 @@ abstract class Horde_Imap_Client_Base implements Serializable if (is_null($this->cache)) { $p = $this->_params; - $this->cache = Horde_Imap_Client_Cache::singleton(array_merge($p['cache'], array( - 'debug' => $this->_debug, - 'hostspec' => $p['hostspec'], - 'port' => $p['port'], - 'username' => $p['username'] - ))); + try { + $this->cache = Horde_Imap_Client_Cache::singleton(array_merge($p['cache'], array( + 'debug' => $this->_debug, + 'hostspec' => $p['hostspec'], + 'port' => $p['port'], + 'username' => $p['username'] + ))); + } catch (InvalidArgumentException $e) { + return false; + } } if (!$current) { diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Cache.php b/framework/Imap_Client/lib/Horde/Imap/Client/Cache.php index a9c46dac1..d38a23310 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Cache.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Cache.php @@ -112,10 +112,9 @@ class Horde_Imap_Client_Cache * * @param array $params The configuration parameters. * - * @throws Horde_Imap_Client_Exception * @throws InvalidArgumentException */ - public function __construct($params = array()) + public function __construct(array $params = array()) { if (empty($params['cacheob']) || empty($params['hostspec']) || @@ -148,7 +147,7 @@ class Horde_Imap_Client_Cache } if (is_null($compress)) { - throw new Horde_Imap_Client_Exception('Horde_Cache does not support the compression type given.'); + throw new InvalidArgumentException('Horde_Cache does not support the compression type given.'); } }