Subject: php + imap troble

From: Sorrow Angel <[email-masked]>
Date: Sat, 22 Nov 2003 15:51:13 +0400

Hello,

Description:
------------
On RHL7.3 Apache2.0.44 PHP4.3.4 (cclient - do not remember version)- is
work fine.
Changing OS & soft on freeBSD, Apache2.0.48, 4.3.4, cclient-2002d,1
not work:
script terminated after 30s (in my news group 5 messages)
and in apache error log this:
child pid 21979 exit signal Segmentation fault (11)

Such an error comes on 4.9 + Apache 1.3.29 +
cclient-(all version) php-4.3.x (as mod_php & as CLI).
Such an error appears on FREBSD ONLY!!!
How can it be done away?

Reproduce code:
---------------
<?php
$nntp=imap_open("{news.mydomain.tld:119/nntp}newsgroup", "", "");
$headers=imap_headers($nntp);
$threads=imap_thread($nntp);
while(list($key, $val) = each($threads)){
    $tree=explode(".", $key);
    if($tree[1] == "num"){
        print "<ul>\n<li>".$headers[$val - 1]."\n";
    }else if($tree[1]=="branch"){
        print "</ul>\n";
    }
}
imap_close($nntp);
?>

I think, but this bug not in PHP.
I am try this action with any other version Apache (1.3.29, 2.0.48), UW
IMAP, etc. The result is same.
It works on RHL8, Windows(2000,XP), bot doesnt work on FreeBSD
5.1(p10).
CLI imap_thread works as it has to. But when call this function, and if
PHP works as Apache2 module - Apache2 goes to core (child pid 43381
exit signal Segmentation fault (11)). Apache2 not threaded.
All is compiled using keys CFLAGS=-O -pipe, COPTFLAGS=-O -pipe

PHP configure line:
-------------------
--exec-prefix=/usr/local/php --with-apxs(2) --enable-debug
--with-config-file-path=/usr/local/etc --with-imap

GDB backtrace:
--------------
#0  0x2859c7d3 in mail_thresd_references ()
   from /usr/local/lib/libc-client4.so.8
#1  0x2859bcf7 in mail_thread_msgs () from
/usr/local/lib/libc-client4.so.8
#2  0x285ae7c5 in nntp_thread () from /usr/local/lib/libc-client4.so.8
#3  0x2859bc31 in mail_thread () from /usr/local/lib/libc-client4.so.8
#4  0x284161a6 in zif_mail_thread (ht=1, return_value=0x8172164,
this_ptr=0x0,
    return_value_used=1) at
/home/trn/php-4.3.4RC3/ext/imap/php_imap.c:3991
#5  0x2852361e in execute (op_array=0x816b424)
    at /home/trn/php-4.3.4RC3/Zend/zend_execute.c:1616
#6  0x28511ec1 in zend_execute_scripts (type=8, retval=0x0,
file_count=3)
    at /home/trn/php-4.3.4RC3/Zend/zend.c:884
#7  0x284db443 in php_execute_script (primary_file=0xbfbff920)
    at /home/trn/php-4.3.4RC3/main/main.c:1729
#8  0x285295b6 in php_handler (r=0x8163050)
    at /home/trn/php-4.3.4RC3/sapi/apache2handler/sapi_apache2.c:537
#9  0x08065239 in ap_run_handler ()
#10 0x08065844 in ap_invoke_handler ()
#11 0x08062049 in ap_process_request ()
#12 0x0805d107 in ap_process_http_connection ()
#13 0x0806f1e9 in ap_run_process_connection ()
#14 0x0806f50e in ap_process_connection ()
#15 0x0806397b in child_main ()
#16 0x08063a4c in makr_child ()
#17 0x08063b92 in startup_children ()
#18 0x08063f66 in ap_mpm_run ()
#19 0x0806aa66 in main ()
#20 0x0805cc15 in _start ()

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------