Enable track_errors.
authorJan Schneider <jan@horde.org>
Thu, 5 Aug 2010 14:12:49 +0000 (16:12 +0200)
committerJan Schneider <jan@horde.org>
Mon, 9 Aug 2010 13:30:52 +0000 (15:30 +0200)
framework/Http/lib/Horde/Http/Response/Fopen.php

index 4d8b405..e681069 100644 (file)
@@ -41,9 +41,15 @@ class Horde_Http_Response_Fopen extends Horde_Http_Response_Base
      */
     public function getBody()
     {
+        $oldTrackErrors = ini_set('track_errors', 1);
         $content = @stream_get_contents($this->_stream);
+        ini_set('track_errors', $oldTrackErrors);
         if ($content === false) {
-            throw new Horde_Http_Exception('Problem reading data from ' . $this->uri . ': ' . $php_errormsg);
+            $msg = 'Problem reading data from ' . $this->uri;
+            if (isset($php_errormsg)) {
+                $msg .= ': ' . $php_errormsg;
+            }
+            throw new Horde_Http_Exception($msg);
         }
         return $content;
     }