#18791 [Com]: imap_fetch_overview fails to fetch all headers

From: Date: Fri, 09 Aug 2002 21:06:44 +0000
Subject: #18791 [Com]: imap_fetch_overview fails to fetch all headers
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-16407@lists.php.net to get a copy of this message
 ID:               18791
 Comment by:       jacooper@isr.umd.edu
 Reported By:      jacooper@isr.umd.edu
 Status:           Feedback
 Bug Type:         IMAP related
 Operating System: Solaris 2.6
 PHP Version:      4.2.2
 New Comment:

We're working on installing a developer snapshot and testing the code
against the new installation. I'll hopefully have an update sometime
next week.


Previous Comments:
------------------------------------------------------------------------

[2002-08-07 17:00:06] kalowsky@php.net

tried to debug this today.  your script seems to work fine, but I can
only get one message on my IMAP server (silly quotas).  can you try a
development snapshot and see if this still works for you?

------------------------------------------------------------------------

[2002-08-07 15:56:29] jacooper@isr.umd.edu

ack, botched the summary when I submitted. My apologies.

-Jason

------------------------------------------------------------------------

[2002-08-07 14:13:14] jacooper@isr.umd.edu

PHP built with: 

'./configure' '--with-apxs=/export/software/httpd/bin/apxs'
'--with-ldap=/dept/isr/local' '--with-snmp=/dept/isr/local'
'--with-imap=/dept/isr/local' '--with-mysql' '--with-gd=/usr/local'
'--disable-safe-mode' '--prefix=/dept/isr/local'
'--with-config-file-path=/export/software/httpd/conf' '--enable-cli'
'--with-openssl=/dept/isr/local' '--with-imap-ssl=/dept/isr/local'

according to phpinfo. c-client version is 2002-RC2, according to my SA.
The following code snippet does not result in the expected result:


$sorted_array = imap_sort($mbox, SORTDATE, 0, SE_UID);
$sequence = implode(",",$sorted_array);
$overview = imap_fetch_overview($mbox,$sequence,FT_UID);
if(is_array($overview)) {
        reset($overview);
        while( list($key,$val) = each($overview)) {
                print     $val->msgno
                . " - " . $val->date
                . " - " . $val->subject
                . "<br>\n";
        }
} else {
        print "Bollocks, overview fails again<br>\n";
}

I would expect that this code snippet would return a header for each
message in the mailbox I have opened in my imap_open call. 

The behavior I experience is that I will get a small number of headers
(call it $x) the first time I run imap_fetch_overview. If I put
imap_fetch_overview in a for/while loop, it will return $x+1 headers
($x seems to increment each iteration) on each iteration. I do not
change the sequence I give to imap_fetch_overview while doing this. 

I have also tried setting sequence to the first and last message UID,
seperated by a :. This results in the same behavior.

For example, if I have a mailbox with 70 messages, the first iteration
will return 9 headers. The next 10, after that 11, and so on until
eventually it appears to not get a full header for a message. I'm
guessing it hits the script time execution limit when this happens but
I have not tested increasing that limit to see what happens. 

If I have missed any relevant information, please let me know and I'll
provide it as soon as possible.

Thanks
Jason

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=18791&edit=1



Thread (5 messages)

« previous php.bugs (#16407) next »