diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php
index 2385b1edd64bb020cfbcfd69cf68406df1f62318..71844b8478f9682d93a00b896bbb63ed540976a3 100644
--- a/inc/HTTPClient.php
+++ b/inc/HTTPClient.php
@@ -333,9 +333,11 @@ class HTTPClient {
 
                 $byte = fread($socket,1);     // readtrailing \n
                 $chunk_size = hexdec($chunk_size);
-                $this_chunk = fread($socket,$chunk_size);
-                $r_body    .= $this_chunk;
-                if ($chunk_size) $byte = fread($socket,2); // read trailing \r\n
+                if ($chunk_size) {
+                    $this_chunk = fread($socket,$chunk_size);
+                    $r_body    .= $this_chunk;
+                    $byte = fread($socket,2); // read trailing \r\n
+                }
 
                 if($this->max_bodysize && strlen($r_body) > $this->max_bodysize){
                     $this->error = 'Allowed response size exceeded';
diff --git a/inc/JpegMeta.php b/inc/JpegMeta.php
index 41e6e0803345acc4fab005bdf87bada4c51be9ff..cb1d7d694e0589ae2594df1ab746ba83bba72c0a 100644
--- a/inc/JpegMeta.php
+++ b/inc/JpegMeta.php
@@ -995,7 +995,10 @@ class JpegMeta
             $this->_markers[$count]['length'] = $length;
 
             if ($capture) {
-                $this->_markers[$count]['data'] =& fread($this->_fp, $length);
+                if ($length)
+                    $this->_markers[$count]['data'] =& fread($this->_fp, $length);
+                else
+                    $this->_markers[$count]['data'] = "";
             }
             elseif (!$done) {
                 $result = @fseek($this->_fp, $length, SEEK_CUR);
@@ -1213,12 +1216,12 @@ class JpegMeta
         else {
             if ($marker == 0xDA) {  // Copy until EOF
                 while (!feof($this->_fp)) {
-                    $data =& fread($this->_fp, 1024 * 16);
+                    $data = fread($this->_fp, 1024 * 16);
                     fputs($this->_fpout, $data, strlen($data));
                 }
             }
             else { // Copy only $length bytes
-                $data =& fread($this->_fp, $length);
+                $data = @fread($this->_fp, $length);
                 fputs($this->_fpout, $data, $length);
             }
         }
diff --git a/inc/changelog.php b/inc/changelog.php
index def785f43b1deac6027c629191df1cdc904c26f8..f60b487db36819a94c19a1619840cc38d921b6db 100644
--- a/inc/changelog.php
+++ b/inc/changelog.php
@@ -250,7 +250,7 @@ function getRevisionInfo($id, $rev, $chunk_size=8192) {
     $got = 0;
     fseek($fp, $head);
     while ($got<$chunk_size && !feof($fp)) {
-      $tmp = fread($fp, max($chunk_size-$got, 0));
+      $tmp = @fread($fp, max($chunk_size-$got, 0));
       if ($tmp===false) { break; } //error state
       $got += strlen($tmp);
       $chunk .= $tmp;
@@ -335,7 +335,7 @@ function getRevisions($id, $first, $num, $chunk_size=8192) {
       $read_size = max($tail-$finger, 0); // found chunk size
       $got = 0;
       while ($got<$read_size && !feof($fp)) {
-        $tmp = fread($fp, max($read_size-$got, 0));
+        $tmp = @fread($fp, max($read_size-$got, 0));
         if ($tmp===false) { break; } //error state
         $got += strlen($tmp);
         $chunk .= $tmp;