While getting data from a stream it is possible to reach the end, so we should check...
[squirrelmail.git] / functions / mime.php
index 6271141a04da4115e6f2baa188ce19a4741089b1..52a452ea6cd11ba6c8381a3971db604f0ba5d849 100644 (file)
@@ -64,7 +64,7 @@
       $read = fgets ($imap_stream, 10000);
       $response = substr($read, 0, 4);
       $bodystructure = "";
-      while ($response != "a001") {
+      while ($response != 'a001' ) && !feof( $imap_stream ) {
          $bodystructure .= $read;
          $read = fgets ($imap_stream, 10000);
          $response = substr($read, 0, 4);
          return $regs[1];
       }
       
-      $str = "Body retrival error.  Please report this bug!\n";
+      $str = "Body retrieval error.  Please report this bug!\n";
       $str .= "Response:  $response\n";
       $str .= "Message:  $message\n";
       $str .= "FETCH line:  $topline";