Skip to content

Commit

Permalink
Ensure we have at least one fetch element
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Sep 17, 2014
1 parent cd70c11 commit f2fbf36
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions framework/Imap_Client/lib/Horde/Imap/Client/Socket.php
Expand Up @@ -2926,17 +2926,14 @@ protected function _fetchCmd(
/* A UID FETCH will always return UID information (RFC 3501
* [6.4.8]). Don't add to query as it just creates a longer
* FETCH command. */
if ($sequence || (count($options['_query']) === 1)) {
if ($sequence) {
$fetch->add('UID');
}
break;

case Horde_Imap_Client::FETCH_SEQ:
// Nothing we need to add to fetch request unless sequence is
// the only criteria.
if (count($options['_query']) === 1) {
$fetch->add('UID');
}
/* Nothing we need to add to fetch request unless sequence is
* the only criteria (see below). */
break;

case Horde_Imap_Client::FETCH_MODSEQ:
Expand All @@ -2950,6 +2947,11 @@ protected function _fetchCmd(
}
}

/* If empty fetch, add UID to make command valid. */
if (!count($fetch)) {
$fetch->add('UID');
}

/* Add changedsince parameters. */
if (empty($options['changedsince'])) {
$fetch_cmd = $fetch;
Expand All @@ -2958,9 +2960,7 @@ protected function _fetchCmd(
* modseq. In that case, we don't have any other FETCH attributes,
* but RFC 3501 requires at least one specified attribute. */
$fetch_cmd = array(
count($fetch)
? $fetch
: new Horde_Imap_Client_Data_Format_List('UID'),
$fetch,
new Horde_Imap_Client_Data_Format_List(array(
'CHANGEDSINCE',
new Horde_Imap_Client_Data_Format_Number($options['changedsince'])
Expand Down

0 comments on commit f2fbf36

Please sign in to comment.