From 0bb314620bfd8f8eab2ca2e63f3aa5715fb4c4a0 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sun, 18 Jul 2010 12:31:40 -0400 Subject: [PATCH] Ignore exceptions from the Http client here. Probably from reading an empty body from the stream --- .../lib/Horde/Service/Twitter/Request/Oauth.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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); } -- 2.11.0