Skip to content

Commit

Permalink
Don't allow empty PARTIAL limiters
Browse files Browse the repository at this point in the history
See Ticket #13153
  • Loading branch information
slusarz committed May 6, 2014
1 parent 9015aca commit 4e3d0ec
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions framework/Imap_Client/lib/Horde/Imap/Client/Socket.php
Expand Up @@ -2118,6 +2118,16 @@ protected function _search($query, $options)
}
}

if (!empty($options['partial'])) {
$pids = $this->getIdsOb($options['partial'], true)->range_string;
if (!strlen($pids)) {
throw new InvalidArgumentException('Cannot specify empty sequence range for a PARTIAL search.');
}
if (strpos($pids, ':') === false) {
$pids .= ':' . $pids;
}
}

$charset = is_null($options['_query']['charset'])
? 'US-ASCII'
: $options['_query']['charset'];
Expand Down Expand Up @@ -2154,11 +2164,6 @@ protected function _search($query, $options)
/* Can't have both ALL and PARTIAL returns. */
$results = array_diff($results, array('ALL'));

$pids = $this->getIdsOb($options['partial'], true)->range_string;
if (strpos($pids, ':') === false) {
$pids .= ':' . $pids;
}

$results[] = 'PARTIAL';
$results[] = $pids;
}
Expand Down Expand Up @@ -2210,11 +2215,6 @@ protected function _search($query, $options)
// Can't have both ALL and PARTIAL returns.
$results = array_diff($results, array('ALL'));

$pids = $this->getIdsOb($options['partial'], true)->range_string;
if (strpos($pids, ':') === false) {
$pids .= ':' . $pids;
}

$results[] = 'PARTIAL';
$results[] = $pids;
}
Expand Down

0 comments on commit 4e3d0ec

Please sign in to comment.