#2072 Server responded: Bogus sequence in FETCH


Upgraded to squirrelmail 1.4.6 recently from an earlier
release and since then have been receiveing this error
message on specific mailboxes of certain users when
they attempt to sort on From with server-side sorting
turned on.

uw-imap-2002d-11, RHEL3 RPM
php-4.3.2-26ent RHEL3 RPM
squirrelmail connects to latest version of up.imapproxy

Sorting on other values and/or turning off server side
sorting would make the offending message disappear.

Poked around a bit, and found that in all the offending
mailboxes, the IMAP responses like the following were
being given (sorry, not that familiar with the protocol):
before the actual * SORT response.

* OK [PARSE] Unexpected characters after address in
group: 2005 MAILER-DAEMON@mail2world.com (Mail Delivery

Poking around some more, it looks like within
sqimap_get_sort_order in functions/imap_messages.php
the parsing of the IMAP response to the SORT command
would never get to the * SORT line and thus not return
the correct information.

Found a bit of code that looked odd, namely:

for ($i=0,$iCnt=count($sort_test);$i<$iCnt;++$i) {
for ($j =0,$jCnt=count($sort_test[$i]);$j<$iCnt;++$j) {

Changed $iCnt in the second for stanza to $jCnt and now
it looks like the problem has vanished for my
environment since it loops through the array correctly.
Also made a similar change to a similar set of loops
up with something regaridng UID sorting.

However, I'm no coder nor am I horribly familiar with
the ins and outs of IMAP, so I don't know if that's an
actual fix or something that just coincidentally makes
things work.


    • status: open --> closed-fixed
  • Logged In: YES

    Thanks, that is indeed wrong. I've corrected the bug in cvs.