php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19716 imap_headers() returns wrong number of items
Submitted: 2002-10-02 08:26 UTC Modified: 2002-12-30 01:00 UTC
From: teroNOSPAM at alias dot fi Assigned:
Status: No Feedback Package: IMAP related
PHP Version: 4.2.3 OS: linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-10-02 08:26 UTC] teroNOSPAM at alias dot fi
We are using Lotus Domino 5.0.11 as our IMAP server and it seems to work all right with other clients (like Mozilla).
However when we run the script below it only returns correctly 7 oldest messages. All other messages get the following error message: Bad message number in /home/httpd/html/mail/messages.php
count returns 61 messages. It happens in other folders than INBOX too.

PHP was compiled using the following parameters:
./configure  --with-mysql --with-apxs=/usr/sbin/apxs --with-imap --enable-exif --with-kerberos --with-zlib --with-zlib-dir=/usr/lib



<?php


echo "User: ".$_SERVER['PHP_AUTH_USER']."<br><br>";
$link=imap_open("{localhost/imap}INBOX",$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']);

$sorted_array=imap_sort($link,SORTDATE,1);
$headers=imap_headers($link); 


	echo "<br><b>Your messages (".count($sorted_array).")</b><br><hr>";
	for ($x = 1;$x < count($sorted_array); $x++) {
		$msgnum=next($sorted_array);
		$header=imap_header($link,$msgnum, 80,80);
		echo "<a href=\"view.php?num=$msgnum\">$header->fromaddress: ".$header->subject."</a> (ID: $msgnum)<br>";

	}

 

imap_close($link);

?> 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-02 10:50 UTC] sniper@php.net
What c-client version you have? 

 [2002-10-03 01:08 UTC] teroNOSPAM at alias dot fi
I installed c-client from IMAP 2002 RC6.
 [2002-10-12 10:32 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-10-14 04:46 UTC] teroNOSPAM at alias dot fi
I've tried the snapshot today. The formerly included script still returns errors and doesn't finish it's running. (eg. HTML code after the script never shows).
Apache error log says:

[Mon Oct 14 12:22:15 2002] [notice] Apache/1.3.14 (Unix)  (Red-Hat/Linux) PHP/4.3.0-dev configured -- resuming normal operations
[Mon Oct 14 12:22:45 2002] [notice] child pid 14979 exit signal Segmentation fault (11)
 [2002-10-14 04:59 UTC] derick@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2002-10-15 01:11 UTC] teroNOSPAM at alias dot fi
Here's the backtrace:

#0  0x400fe70c in chunk_alloc (ar_ptr=0x40193d60, nb=40) at malloc.c:2763
#1  0x400fe5ce in __libc_malloc (bytes=30) at malloc.c:2696
#2  0x40286f47 in _php_imap_parse_address (addresslist=0x8118130, fulladdress=0xbfffbe1c, paddress=0x8125c1c)
    at /root/php-dev/php4-200210140000/ext/imap/php_imap.c:3587
#3  0x40287227 in _php_make_header_object (myzvalue=0x81255e4, en=0x8117c08) at /root/php-dev/php4-200210140000/ext/imap/php_imap.c:3640
#4  0x4027fbce in zif_imap_headerinfo (ht=4, return_value=0x81255e4, this_ptr=0x0, return_value_used=1)
    at /root/php-dev/php4-200210140000/ext/imap/php_imap.c:1480
#5  0x40375c95 in execute (op_array=0x810c4dc) at /root/php-dev/php4-200210140000/Zend/zend_execute.c:1597
#6  0x40362a93 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /root/php-dev/php4-200210140000/Zend/zend.c:839
#7  0x4033c5c3 in php_execute_script (primary_file=0xbffff828) at /root/php-dev/php4-200210140000/main/main.c:1542
#8  0x4037e861 in apache_php_module_main (r=0x80f2614, display_source_mode=0) at /root/php-dev/php4-200210140000/sapi/apache/sapi_apache.c:55
#9  0x4037f35a in send_php (r=0x80f2614, display_source_mode=0, filename=0x0) at /root/php-dev/php4-200210140000/sapi/apache/mod_php4.c:564
#10 0x4037f3b8 in send_parsed_php (r=0x80f2614) at /root/php-dev/php4-200210140000/sapi/apache/mod_php4.c:579
#11 0x80535ee in ap_invoke_handler () from /usr/kerberos/lib/libcom_err.so.3
#12 0x8061d0b in ap_some_auth_required () from /usr/kerberos/lib/libcom_err.so.3
#13 0x8061d68 in ap_process_request () from /usr/kerberos/lib/libcom_err.so.3
#14 0x805bcf0 in ap_child_terminate () from /usr/kerberos/lib/libcom_err.so.3
#15 0x805be57 in ap_child_terminate () from /usr/kerberos/lib/libcom_err.so.3
#16 0x805bf58 in ap_child_terminate () from /usr/kerberos/lib/libcom_err.so.3
#17 0x805c408 in ap_child_terminate () from /usr/kerberos/lib/libcom_err.so.3
#18 0x805ca0f in main () from /usr/kerberos/lib/libcom_err.so.3
#19 0x400bd9cb in __libc_start_main (main=0x805c790 <main>, argc=2, argv=0xbffffb54, init=0x804f160 <_init>, fini=0x807bfbc <_fini>,
    rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xbffffb4c) at ../sysdeps/generic/libc-start.c:92
 [2002-10-15 01:23 UTC] teroNOSPAM at alias dot fi
Changing status to Open. 

If you need any further information, please contact me.
 [2002-12-07 01:50 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-12-30 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Aug 07 12:01:24 2020 UTC