|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-02-25 22:18 UTC] hroi at asdf dot dk
I was experimenting with php's imap support and it seemed to work ok, but then things started crashing.
httpd exits with the following message:
[Sat Feb 26 04:03:05 2000] [notice] child pid 87650 exit signal Abort trap (6)
Short script:
<html>
<head>
<title>fdl</title>
</head>
<body>
<?php
$link = imap_open("{imap.asdf.dk:143}INBOX","cetec","cetec");
$nmsgs = imap_num_msg($link);
print $nmsgs;
for($i=0; $i <= $nmsgs; $i++) {
$fullheader = imap_fetchheader($link, $i);
$headers = explode("\r\n", $fullheader);
print "DEBUG: count(\$headers) == " . count($headers) . "<br>\n";
for($j = 0; $j <= count($headers); $j++) {
if (ereg("^Subject: (.*)\$", $headers[$j+1], $eregs)) {
print $eregs[1] . "<hr>\n";
}
}
}
?>
</body>
</html>
No php.ini.
Relevant modules: imap (v 4.7 client lib)
Apache 1.3.11.
I'm willing to be instructed in how to debug this. Just mail me.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 09:00:01 2025 UTC |
Don't fetch the headers for message 0 - your for loop should look like this: for($i=1; $i <= $nmsgs; $i++) {...} It still shouldn't crash, though. I'm looking into why it does...Here's a backtrace. Makes no sense to me, though - why is it getting into imap_mail_compose? This is using the same test code provided below (with the off-by-one error needed to produce the crash). Program received signal SIGABRT, Aborted. 0x400c7911 in kill () from /lib/libc.so.6 (gdb) bt #0 0x400c7911 in kill () from /lib/libc.so.6 #1 0x400c75f8 in raise () from /lib/libc.so.6 #2 0x400c8c51 in abort () from /lib/libc.so.6 #3 0x402d100f in utf8_text_2022 () at utf8.c:755 #4 0x402c068c in mail_partial_body () at mail.c:1161 #5 0x402520ea in php_if_imap_mail_compose () at imap.c:295 #6 0x402210dd in execute () at ./zend_execute.c:940 #7 0x4020bd19 in cfgparse () at configuration-parser.y:320 #8 0x40239593 in php_if_apache_note () at php_apache.c:114 #9 0x40239ee6 in php_if_getallheaders () at php_apache.c:114 #10 0x40239f36 in php_if_apache_lookup_uri () at php_apache.c:114 #11 0x8053e64 in ap_invoke_handler (r=0x80f5afc) at http_config.c:508 #12 0x80625ec in process_request_internal (r=0x80f5afc) at http_request.c:1214 #13 0x8062648 in ap_process_request (r=0x80f5afc) at http_request.c:1230 #14 0x805c439 in child_main (child_num_arg=0) at http_main.c:4122 #15 0x805c5cc in make_child (s=0x8099c24, slot=0, now=951851188) at http_main.c:4235 #16 0x805c6e9 in startup_children (number_to_start=5) at http_main.c:4317 #17 0x805cb9b in standalone_main (argc=2, argv=0xbffff7a4) at http_main.c:4605 #18 0x805d24d in main (argc=2, argv=0xbffff7a4) at http_main.c:4933