Skip to content

Commit

Permalink
Fix PHP warning in compressMessageSet() and clarify result on an empt…
Browse files Browse the repository at this point in the history
…y input
  • Loading branch information
alecpl committed Nov 21, 2024
1 parent c05d44c commit 785e9bc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions program/lib/Roundcube/rcube_imap_generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -2062,7 +2062,7 @@ public function fetchHeaderIndex($mailbox, $message_set, $index_field = '', $ski
{
// Validate input
if (is_array($message_set)) {
if (!($message_set = $this->compressMessageSet($message_set))) {
if (($message_set = $this->compressMessageSet($message_set)) === 'INVALID') {
return false;
}
} elseif (empty($message_set)) {
Expand Down Expand Up @@ -4042,7 +4042,7 @@ protected static function r_implode($element)
* @param array|string $messages Message identifiers
* @param bool $force Forces compression of any size
*
* @return string Compressed sequence-set
* @return string Compressed sequence-set or 'INVALID' on invalid or empty input
*/
public static function compressMessageSet($messages, $force = false)
{
Expand All @@ -4063,6 +4063,10 @@ public static function compressMessageSet($messages, $force = false)
$messages = explode(',', $messages);
}

if (empty($messages)) {
return 'INVALID';
}

sort($messages);

$result = [];
Expand Down

0 comments on commit 785e9bc

Please sign in to comment.