summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-09-07 07:53:01 +0000
committeralecpl <alec@alec.pl>2009-09-07 07:53:01 +0000
commit4a63f1efaff83dd03e663ed1a432a15dc0100be3 (patch)
tree88fe563cb09033b33fb51b5fbf9d23fc99e427ec
parente077870affc064e958d9f3077b1e3373634e24b7 (diff)
- Fix roundcube hangs on empty inbox with bincimapd (#1486093)
-rw-r--r--CHANGELOG1
-rw-r--r--program/include/rcube_imap.php6
-rw-r--r--program/lib/imap.inc10
3 files changed, 10 insertions, 7 deletions
diff --git a/CHANGELOG b/CHANGELOG
index af6306df6..aff6dadd8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
+- Fix roundcube hangs on empty inbox with bincimapd (#1486093)
- Fix wrong headers for IE on servers without $_SERVER['HTTPS'] (#1485926)
- Force IE style headers for attachments in non-HTTPS session, 'use_https' option (#1485655)
- Check 'post_max_size' for upload max filesize (#1486089)
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 3d8cb84b8..f1729311b 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -2228,8 +2228,10 @@ class rcube_imap
$msg_count = $this->_messagecount($mailbox);
$cache_count = count($cache_index);
- // console("Cache check: $msg_count !== ".count($cache_index));
-
+ // empty mailbox
+ if (!$msg_count)
+ return $cache_count ? -2 : 1;
+
if ($cache_count==$msg_count) {
if ($this->skip_deleted) {
$h_index = iil_C_FetchHeaderIndex($this->conn, $mailbox, "1:*", 'UID', $this->skip_deleted);
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index 02c9bd9b5..c640c56e4 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -1510,11 +1510,11 @@ function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false, $bo
preg_match('/ BODY\[HEADER.FIELDS \(.*?\)\]\s*(.*)$/s', $line, $m);
$reslines = explode("\n", trim($m[1], '"'));
// re-parse (see below)
- foreach ($reslines as $line) {
- if (ord($line[0])<=32) {
- $lines[$ln] .= (empty($lines[$ln])?'':"\n").trim($line);
+ foreach ($reslines as $resln) {
+ if (ord($resln[0])<=32) {
+ $l[$ln] .= (empty($lines[$ln])?'':"\n").trim($resln);
} else {
- $lines[++$ln] = trim($line);
+ $lines[++$ln] = trim($resln);
}
}
}
@@ -1668,7 +1668,7 @@ function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false, $bo
}
}
}
- } while (strcmp($a[0], $key) != 0);
+ } while (!iil_StartsWith($line, $key, true));
return $result;
}