소스 검색

Some IMAP servers handle empty bodies different. NIL is a valid response for the body, but we always expect a literal with a size. See RFC2180 sec 4.1.3.

jangliss 17 년 전
부모
커밋
44d36821b1
2개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      ChangeLog
  2. 2 0
      functions/mime.php

+ 3 - 0
ChangeLog

@@ -236,6 +236,9 @@ Version 1.5.2 - SVN
   - Added SquirrelMail debug mode.
   - Handle PHP's insistence on setting the value to 'deleted' for destroyed sessions
     (#1829098).
+  - Some IMAP servers send nil for an empty email body (See RFC2180,
+    section 4.1.3 on empty strings).
+
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------

+ 2 - 0
functions/mime.php

@@ -147,6 +147,8 @@ function mime_fetch_body($imap_stream, $id, $ent_id=1, $fetch_size=0) {
 //        }
     } else if (ereg('"([^"]*)"', $topline, $regs)) {
         $ret = $regs[1];
+    } else if ((stristr($topline, 'nil') !== false) && (empty($wholemessage))) {
+        $ret = $wholemessage;
     } else {
         global $where, $what, $mailbox, $passed_id, $startMessage;
         $par = 'mailbox=' . urlencode($mailbox) . '&passed_id=' . $passed_id;