From a35808a2db184258572668223dda521cbefd5ca2 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 12 Mar 2009 13:04:26 -0600 Subject: [PATCH] Fix list when dealing with empty mailboxes --- framework/Imap_Client/lib/Horde/Imap/Client/Base.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Base.php b/framework/Imap_Client/lib/Horde/Imap/Client/Base.php index ba111a160..1d1ef9587 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Base.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Base.php @@ -2330,12 +2330,16 @@ abstract class Horde_Imap_Client_Base $res = $this->search($this->_selected, $search, array('sort' => array(Horde_Imap_Client::SORT_ARRIVAL))); $ret = array('uids' => $res['sort']); if ($seq) { - if (empty($ids)) { - $ids = range(1, count($ret['uids'])); + if (!$res['count']) { + $ret['lookup'] = array(); } else { - sort($ids, SORT_NUMERIC); + if (empty($ids)) { + $ids = range(1, $res['count']); + } else { + sort($ids, SORT_NUMERIC); + } + $ret['lookup'] = array_combine($ret['uids'], $ids); } - $ret['lookup'] = array_combine($ret['uids'], $ids); } return $ret; -- 2.11.0