php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14101 imap_sort returns irregular sort sequence
Submitted: 2001-11-18 22:30 UTC Modified: 2001-12-13 06:29 UTC
From: richard at bridgetechmedia dot com Assigned:
Status: Closed Package: IMAP related
PHP Version: 4.0.5 OS: Linux 2.4.10 (rH7.1)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: richard at bridgetechmedia dot com
New email:
PHP Version: OS:

 

 [2001-11-18 22:30 UTC] richard at bridgetechmedia dot com
Hello folks... 
Imap sort works only with small mailbox...

<--- snip --->
  $newstrm = imap_open ($ms.$selectedmb, $usr, $usrpwd) or die ("cant connect: ".imap_last_error());
  switch ($sortby) {
    case "date":
  $sorted_headers = imap_sort($newstrm,SORTDATE, $rev_flag,'');
      break;
    case "subject":
  $sorted_headers = imap_sort($newstrm,SORTSUBJECT, $rev_flag,'');
      break;
    case "tag":
      if ($tag == "From") {
  $sorted_headers = imap_sort($newstrm,SORTFROM, $rev_flag,'');
      } else {
  $sorted_headers = imap_sort($newstrm,SORTTO, $rev_flag,'');
      }
      break;
    case "size":
  $sorted_headers = imap_sort($newstrm,SORTSIZE, $rev_flag,'');
      break;
  }
  while (list(,$qq) = each($sorted_headers)) {
    $header = imap_headerinfo($newstrm, $qq);

   ....>>> etc
<--- snip --->
the sort sequence returned by imap_sort is incorrect for any mailbox where there is more than 10 emails in the mailbox, and especially if there is a mix of "R" and "U" type of unread.
The function appears to sort partly by new, and then old, and then both...

<========== php compiled with ========
 './configure' '--with-mysql=/usr/local/mysql' '--with-xml' '--with-apache=../apache_1.3.19/' '--with-imap=/usr/local/imap' '--enable-track-vars' 

<======== imap specs ===========
compiled from :

imap-2001.BETA.SNAP-0106191041.tar

<========= hardware ============>

intel Pentium 4 1.3 Ghz
640 meG ram
400MHZ BUS MOTHERBOARD

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-19 18:01 UTC] sniper@php.net
First of all update your c-client to imap-2001a:

ftp://ftp.cac.washington.edu/mail/imap.tar.Z

also get the latest RC of PHP from:

http://download.php.net/~zeev/php-4.1.0RC3.tar.gz


--Jani

 [2001-12-13 06:29 UTC] sander@php.net
No feedback. Closing.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jun 30 19:01:35 2025 UTC