#1381 1.4.1 sort by received date broken

Eric Smith

Just upgraded from 1.4.0 to 1.4.1. Sort by received date
no longer works, sorting is now by the Date header despite
enabling the "Enable Sort by of Receive Date" option (which
is grammatically incorrect). No change was made to any
other email system components.

Web server is running Red Hat 9 with Apache 2.0.40.
IMAP server is Courier-IMAP.

Possibly related to the recent fixes to header parsing,
or to the IMAP performance improvements?


  • Logged In: YES

    The order is sort by receive date. The displayed date is the
    rfc822 header date.

    Others find it confusing that the displayed date in
    message-list doesn't match the date in message-view so I
    changed it.

  • Eric Smith
    Eric Smith

    Logged In: YES

    Stekkel, what you describe is how 1.4.0 worked. Under
    1.4.1, it is BOTH sorting by and displaying the RFC822 date
    header. I have 1.4.0 installed in a different directory on
    the server and have verified that with the same
    configuration ("Enable Sort by of Receive Date" enabled),
    the two releases behave differently. As far as I can tell,
    the 1.4.1 behavior is broken.

    • priority: 5 --> 1
  • Logged In: YES

    Please provide more detail about your IMAP server, operating
    system, Version of SquirrelMail, and the circumstances which
    produced the bug.

    Since we could not reproduce this problem, providing the same
    information will not help. Please be as specific as possible.
    Some problems may require taht we make a coding effort and then
    you try the new version to see the results. Thanks for your help.

  • Eric Smith
    Eric Smith

    Logged In: YES

    The server is running Red Hat 9 with Apache 2.0.40. The
    IMAP server is Courier-IMAP 2.0.0, though the problem was
    also observed with 1.3.7, 2.1.1, and 3.0.2. I'm running
    SquirrelMail 1.4.1. The cirumstances which produced the bug
    is the upgrade from SM 1.4.0 to SM 1.4.1; the sort by
    receive date feature worked fine in SM 1.4.0, and I have
    NEVER seen it work in 1.4.1.

    I have confirmed multiple times that "Enable Sort by of
    Receive Date:" on the display preferences is enabled. Now
    it is sorting by the date header in the message, so I
    routinely get messages (and spam) with dates that are months
    or years in the past or future, which results in new
    messages being sorted with very old messages, or staying at
    the top of the list despite there being more recently
    received messages.

    I have SM 1.4.0 still installed in another directory, and
    can confirm that it still sorts correctly by received date.
    A message that I received a week ago, but is dated August
    2004, always sorts to the top when I use SM 1.4.1, but 1.4.0
    sorts it properly. Thus I really do not believe that the
    problem is with my web server or IMAP server.

    I'd be happy to create you an account on my mail server if
    it would help. You could send test messages to the account
    and see how they sort, and you could also examine the
    mailbox using another client program with IMAP over SSL.

  • Eric Smith
    Eric Smith

    Logged In: YES

    I've just installed 1.4.2, and it fails to sort by received
    date just like 1.4.1. While 1.4.0 still works correctly.

  • Logged In: YES

    Open functions/imap_messages.php and search for the
    following line:

    case 'date': $date = $value; break;

    and comment it out by doing:

    // case 'date': $date = $value; break;

    The result will be that the internaldate value will not be
    overwritten when INTERNALDATE is returned before the HEADER
    fileds are returned. That should solve your issue.

    Soon I will fix this more permanently.

    The reason I couldn't produce it was because in my case the
    INTERNALDATE was returned after the HEADER and besides, I'm
    using serverside sorting which you should use to because
    courier supports it. On top of my head I do not know how it
    will work with serverside sorting but I will take a look.

    Sorry that it took so long but I didn't expect I realy
    introduced a bug by rewriting that function completely and
    everything worked fine in my case ;)

    • priority: 1 --> 7
    • status: open --> pending
  • Logged In: YES

    Can you please retest this issue, and see if it is still an
    issue with the latest release, or if Marc's changes are
    working for you?

  • Eric Smith
    Eric Smith

    Logged In: YES

    It is working correctly in 1.4.3a.


  • Eric Smith
    Eric Smith

    • status: pending --> open
  • Eric Smith
    Eric Smith

    Logged In: YES

    "Enable sort by of Receive Date" is still gramatically
    incorrect, though.
    Should be "Enable sort by Received Date" or even just "Sort
    by Received Date". (The word "Enable" doesn't seem to add
    anything useful here.)

    • assigned_to: nobody --> jangliss
  • Logged In: YES

    Yes, you're absolutely correct. That's terrible english.
    I'll get it corrected.

    • status: open --> closed-fixed