6.0.0-alpha14
7/2/25

[#13971] Horde_Imap_Client_Search_Query with empty ids object
Summary Horde_Imap_Client_Search_Query with empty ids object
Queue Horde Framework Packages
Type Bug
State Resolved
Priority 1. Low
Owners slusarz (at) horde (dot) org
Requester mrubinsk (at) horde (dot) org
Created 04/29/2015 (3717 days ago)
Due
Updated 04/29/2015 (3717 days ago)
Assigned
Resolved 04/29/2015 (3717 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
04/29/2015 08:28:03 PM Michael Slusarz Comment #3
Assigned to Michael Slusarz
State ⇒ Resolved
Reply to this comment
Horde_Imap_Client 2.28.1
04/29/2015 08:27:41 PM Git Commit Comment #2 Reply to this comment
Changes have been made in Git (master):

commit bcd1cd251eb2670d4e3bcfec58aeb8ddc17ba3ff
Author: Michael M Slusarz <slusarz@horde.org>
Date:   Wed Apr 29 14:14:21 2015 -0600

     [mms] Fix search queries where ID list given is explicitly empty, 
indicating that a match can never be successful (Bug #13971).

  .../Imap_Client/lib/Horde/Imap/Client/Base.php     |   46 ++++--
  .../lib/Horde/Imap/Client/Search/Query.php         |  159 
++++++++++++++------
  framework/Imap_Client/package.xml                  |    2 +
  .../test/Horde/Imap/Client/SearchTest.php          |   47 ++++++-
  4 files changed, 193 insertions(+), 61 deletions(-)

http://github.com/horde/horde/commit/bcd1cd251eb2670d4e3bcfec58aeb8ddc17ba3ff
04/29/2015 06:11:22 PM Michael Rubinsky Comment #1
Priority ⇒ 1. Low
Patch ⇒ No
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ Horde_Imap_Client_Search_Query with empty ids object
Type ⇒ Bug
State ⇒ Unconfirmed
Reply to this comment
When performing a search and the search includes an id set that the 
results should belong to, and that id set is empty, the ids object is 
ignored. I.e.:

$q = new Horde_Imap_Client_Search_Query();
$q->dateSearch(new Horde_Date(1427907906), 
Horde_Imap_Client_Search_Query::DATE_BEFORE);

// Obviously a contrived example. $ids in this case would come from 
some stored id list that may or may not contain any messages.
$ids = new Horde_Imap_Client_Ids(array());
$q->ids($ids);

$res = $imapOb()->search(
     new Horde_Imap_Client_Mailbox('sent-mail-may-2011'),
     $q,
     array('results' => array(Horde_Imap_Client::SEARCH_RESULTS_MATCH)));


I would expect that this would return an empty result set, ideally 
short-circuiting the actual search since we know nothing could 
possibly match. Granted, we could check this in client code, but 
nothing in the phpdoc of Horde_Imap_Client would lead me to believe 
that this would be necessary.

Saved Queries