|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38890 imap_sort() returns array of empty values
Submitted: 2006-09-20 02:04 UTC Modified: 2006-09-24 18:36 UTC
From: Russell dot Mosemann at cune dot edu Assigned:
Status: Not a bug Package: IMAP related
PHP Version: 5.1.6 OS: Debian 3.1 Etch
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: Russell dot Mosemann at cune dot edu
New email:
PHP Version: OS:


 [2006-09-20 02:04 UTC] Russell dot Mosemann at cune dot edu
imap_sort($stream, SORTARRIVAL, 1) returns an array with the same number of items as messages in the mailbox (e.g., 438 messages), but each location in the array is empty. The problem occurs with (imap-2002 or imap-2006) and (4.4.2 or 4.4.4 or 5.1.6 or 5.2R4). Reading from the Courier IMAP server with other clients works fine. This is being compiled as a module for Apache 2.2.3. The default locale on the server is en_US.UTF-8.

configure --with-apxs2=/local/apache/bin/apxs --disable-cli \
--disable-cgi --without-pear --disable-ipv6 --disable-all \
--with-imap=/local/home/mose/imap-2006 \
--with-ldap --with-mysql --with-mysql-sock --with-pcre-regex

Reproduce code:
imap_open($stream, $user, $password, $options);
return imap_sort($stream, SORTARRIVAL, 1);

Expected result:
The returned array should be a list of integers representing messages ordered by arrival date and time.

Actual result:
Each location of the array is empty. It is as if the message numbers were lost, or the message number is being retrieved from the wrong place.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-24 18:36 UTC] Russell dot Mosemann at cune dot edu
After debugging the code, the problem was traced to imap-200x using US-ASCII as the default character set when no character set was specified but Courier IMAP 1.7.3 not recognizing that character set. That caused an error to be returned by imap_sort().

One solution is to replace US-ASCII in imap-200x/src/c-client/imap4r1.c with ISO-8859-1 as the default character set. After making that change. imap_sort() returns the expected values.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 15 06:01:31 2024 UTC