Permalink
Browse files

Fix wrong search result on servers without SORT support

  • Loading branch information...
1 parent 703be89 commit 2c59937c6af621f16fd31e9ce6ac01b25151bda5 @alecpl alecpl committed Aug 11, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 program/include/rcube_imap.php
@@ -1012,8 +1012,8 @@ protected function list_search_messages($folder, $page, $slice=0)
$a_msg_headers, $this->sort_field, $this->sort_order);
// only return the requested part of the set
- $a_msg_headers = array_slice(array_values($a_msg_headers),
- $from, min($cnt-$to, $this->page_size));
+ $slice_length = min($this->page_size, $cnt - ($to > $cnt ? $from : $to));
+ $a_msg_headers = array_slice(array_values($a_msg_headers), $from, $slice_length);
if ($slice) {
$a_msg_headers = array_slice($a_msg_headers, -$slice, $slice);

0 comments on commit 2c59937

Please sign in to comment.