Opened 4 years ago

Closed 4 years ago

#1485622 closed Bugs (fixed)

IMAP->message_index has inconsistent return type

Reported by: ziba Owned by:
Priority: 5 Milestone: 0.2-stable
Component: PHP backend Version: 0.2-beta
Severity: critical Keywords:
Cc:

Description

IMAP->message_index has an inconsistent return type which can cause wrong message navigation values when viewing a single message and improper header listings.

There are two places that call $IMAP->message_index()

First is in program/steps/mail/show.inc when listing headers in a large folder on a server without sorting capability. It expects message_index() to return a list of ids.

The second is in program/include/rcube_imap.php:679 when determining the values for rcmcountdisplay. It expects message_index() to return a list of uids.

What message_index actually returns is dependent on the weather

it returns an array of ids if:

  • the message cache is bad or empty and the server has sorting capability
  • we're viewing a page of search results and the server has sorting capability

it returns an array of uids if:

  • the message cache is good

it returns an array of the current sort_field if:

  • the message cache is bad and the server does not have sorting capability
  • we're viewing a page of search results and the server does not have sorting capability


Returning the current sort_field is due to a possible misuse of
iil_C_FetchHeaderIndex($this->conn, $mailbox, "1:$msg_count", $this->sort_field).
The fourth argument is not for sorting, its what will be returned.

Should $IMAP->message_index be changed to always return uids or ids?

Sorry if I'm misunderstanding something. Thanks for looking into this.

Change History (2)

comment:1 Changed 4 years ago by alec

  • Component changed from IMAP connection to PHP backend
  • Milestone changed from later to 0.2-stable

comment:2 Changed 4 years ago by alec

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [2b5c123a].

Note: See TracTickets for help on using tickets.