From: Michael M Slusarz Date: Fri, 16 Jul 2010 18:07:57 +0000 (-0600) Subject: Bug #9142: Fix retrieving IMAP search results when no sort is requested X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=11e6cf161aa02e6c6bd66852283b81c42c17b1e5;p=horde.git Bug #9142: Fix retrieving IMAP search results when no sort is requested --- diff --git a/imp/lib/Search.php b/imp/lib/Search.php index 2a8928db2..74c4987ca 100644 --- a/imp/lib/Search.php +++ b/imp/lib/Search.php @@ -299,8 +299,8 @@ class IMP_Search $sortdir = null) { try { - $results = $this->imapSearch($mailbox, $query, array('reverse' => $sortdir, 'sort' => array($sortby))); - return new IMP_Indices($mailbox, $results['sort']); + $results = $this->imapSearch($mailbox, $query, array('reverse' => $sortdir, 'sort' => is_null($sortby) ? null : array($sortby))); + return new IMP_Indices($mailbox, is_null($sortby) ? $results['match'] : $results['sort']); } catch (Horde_Imap_Client_Exception $e) { return new IMP_Indices(); } @@ -326,7 +326,7 @@ class IMP_Search * Although there is a fallback to a PHP-based display sort, for * performance reasons only do a display sort if it is supported * on the server. */ - if (($_SESSION['imp']['protocol'] == 'imap') && isset($opts['sort'])) { + if (($_SESSION['imp']['protocol'] == 'imap') && !empty($opts['sort'])) { $sort_cap = $imp_imap->queryCapability('SORT'); if (is_array($sort_cap) && in_array('DISPLAY', $sort_cap)) {