From 06bcb9c34e2bbcea3f6730cc0be5c1d01ddda7e5 Mon Sep 17 00:00:00 2001 From: jangliss Date: Wed, 5 Dec 2007 20:25:53 +0000 Subject: [PATCH] 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. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12804 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 3 +++ functions/mime.php | 2 ++ 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 45d05ae1..73543831 100644 --- a/ChangeLog +++ b/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) -------------------------------------- diff --git a/functions/mime.php b/functions/mime.php index d1511d22..bf9701ee 100644 --- a/functions/mime.php +++ b/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; -- 2.25.1