|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-01-27 15:57 UTC] sutter at mygale dot org
The following code crashes PHP when my mailbox is empty !
<html>
<?php
$MAILSERVER= "{pop.mail.com/pop3}";
$link=imap_open($MAILSERVER,"login", "pass");
$headers=imap_headers($link);
for($x=1; $x < count($headers); $x++) {
$idx=($x-1);
echo "<a href=\"view.php3?num=$x\">$headers[$idx]</a><br>";
}
?>
</html>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 04:00:01 2025 UTC |
the POP3 and IMAP drivers in c-client treat an empty mailbox slightly different here both will log this event with mm_log, but while the imap driver logs it just for info with type NIL, the pop driver issues a WARN this leads to a 'fatal error' message in PHP, but it should not crash you may want to check the presence of messages with imap_check() or imap_status() before calling imap_headers() PS: you have an off-by-one error in your example, it should read <= count() instead of < count() in the for-statementhere's a backtrace for this one as well. Once again, it doesn't give me the slightest clue as to what's going wrong. Program received signal SIGSEGV, Segmentation fault. 0x40231555 in zend_plist_delete () at zend_list.c:204 204 } (gdb) bt #0 0x40231555 in zend_plist_delete () at zend_list.c:204 #1 0x40377ba0 in __DTOR_END__ () from /usr/lib/apache/1.3/libphp4.so #2 0x4023172b in zend_fetch_resource () at zend_list.c:204 #3 0x4022e063 in add_index_unset () at zend_API.c:774 #4 0x4020b06f in php_init_config () at configuration-parser.y:138 #5 0x8051bdc in run_cleanups (c=0x80f7a14) at alloc.c:1939 #6 0x8050c54 in ap_clear_pool (a=0x80f598c) at alloc.c:682 #7 0x8050cb4 in ap_destroy_pool (a=0x80f598c) at alloc.c:712 #8 0x8050c40 in ap_clear_pool (a=0x80a556c) at alloc.c:675 #9 0x805c09f in child_main (child_num_arg=0) at http_main.c:3845 #10 0x805c5cc in make_child (s=0x8099c24, slot=0, now=951851762) at http_main.c:4235 #11 0x805c6e9 in startup_children (number_to_start=5) at http_main.c:4317 #12 0x805cb9b in standalone_main (argc=2, argv=0xbffff7a4) at http_main.c:4605 #13 0x805d24d in main (argc=2, argv=0xbffff7a4) at http_main.c:4933The test case for this can be reduced to: <html> <?php $MAILSERVER= "{pop.mail.com/pop3}"; $link=imap_open($MAILSERVER,"login", "pass"); ?> </html> Same cleanup crash. Anyone have an idea what's different about empty pop3 mailboxes that seem to close the resource early?