From: Michael J. Rubinsky Date: Sun, 18 Jul 2010 16:31:40 +0000 (-0400) Subject: Ignore exceptions from the Http client here. Probably from reading an empty body... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0bb314620bfd8f8eab2ca2e63f3aa5715fb4c4a0;p=horde.git Ignore exceptions from the Http client here. Probably from reading an empty body from the stream --- diff --git a/framework/Service_Twitter/lib/Horde/Service/Twitter/Request/Oauth.php b/framework/Service_Twitter/lib/Horde/Service/Twitter/Request/Oauth.php index d1b19fc35..7b2443882 100644 --- a/framework/Service_Twitter/lib/Horde/Service/Twitter/Request/Oauth.php +++ b/framework/Service_Twitter/lib/Horde/Service/Twitter/Request/Oauth.php @@ -39,10 +39,15 @@ class Horde_Service_Twitter_Request_Oauth extends Horde_Service_Twitter_Request throw new Horde_Service_Twitter_Exception($e); } - $body = $response->getBody(); - if ($response->code >= 400 && $response->code <= 500) { - throw new Horde_Service_Twitter_Exception($body); - } + // Looks like some of the http clients (like Fopen) will thrown an + // exception if we try to read an empty stream. Ignore this. + try { + $body = $response->getBody(); + if ($response->code >= 400 && $response->code <= 500) { + throw new Horde_Service_Twitter_Exception($body); + } + } catch (Horde_Http_Exception $e) {} + if (!empty($cache)) { $cache->set($key, $body); }