Hi all...

 I'm new to PHP and I needed to implement some PHP functions on
 a php webmail. I readed the PHP MANUAL and I found a code that
 suits my needs in an example, but it produces segfaults.
 I added the following code:

 if ($ds) 
   $busca="[EMAIL PROTECTED]";
   $sr=ldap_search($ds,"dc=midomain,dc=com", $busca);  
   if( ldap_count_entries($ds,$sr) < 1 )
     SetCookie( "can_use_attachs", "n", time()+3600 );
     $info = ldap_get_entries($ds, $sr);
     if( $info[0]["canuseattachs"][0] == 'y' )
       SetCookie( "can_use_attachs", "y", time()+3600 );
       SetCookie( "can_use_attachs", "n", time()+3600 ); 

 When I reload THOUSANDS of times the above page (using
 autoreload) and I've found that sometimes the above code
 produces an Apache Crash. I get a "Document contained
 no data" and apache/logs/error_log says:

 [notice] child pid 1234 exit with Segmentation Fault
         (core dump on /usr/apache).

 I have lots of them on different times:

[Wed Jul  4 09:10:22 2001] [notice] child pid 29834 exit
 signal Segmentation fault (11)
[Fri Jul  6 13:05:32 2001] [notice] child pid 30124 exit
 signal Segmentation fault (11)

  I did a backtrace on the core file:

(gdb) bt
#0  0xc01f2740 in kill () from /usr/lib/libc.2
#1  0x1a15a0 in sig_coredump ()
#2  <signal handler called>
#3  0xcda50 in read_next_token (tcm=0x40049b20, token=0x77ff1eb8,
    phplval=0x77ff1d58) at token_cache.c:161
#4  0xb2f68 in phplex (phplval=0x77ff1d58) at main.c:488
#5  0xbb9d8 in phpparse () at /usr/lib/bison.simple:432
#6  0xb5974 in php3_parse (yyin=0x40113c98) at main.c:1564
#7  0xb5ed8 in apache_php3_module_main (r=0x400cd840, fd=26,
    display_source_mode=0, preprocessed=0) at main.c:1929
#8  0xb18a4 in send_php3 ()
#9  0xb1970 in send_parsed_php3 ()
#10 0x197204 in ap_invoke_handler ()
#11 0x1ab36c in process_request_internal ()
#12 0x1ab3ec in ap_process_request ()
#13 0x1a2ff8 in child_main ()
#14 0x1a3254 in make_child ()
#15 0x1a35b8 in perform_idle_server_maintenance ()
#16 0x1a3b78 in standalone_main ()
#17 0x1a45c8 in main ()

 The line 161 of token_cache.c contains:

-->        *token = &GLOBAL(tc)->tokens[GLOBAL(tc)->pos++];
        return (*token)->token_type;

 I think something with my above code is wrong, because If I
 comment it using /* and */, then I don't get segfaults (never).
 Any idea of rewriting the above code so that it works would
 be very appreciated. To code the above I copied & pasted the
 PHP manual LDAP functions example, and that's why I'm asking
 directly here.

 Thanks a lot.

Santiago Romero
Departamento de Sistemas

Av. Primado Reig 189, entlo
46020 Valencia - Spain
Telf. (+34) 96 332 12 00
Fax. (+34) 96 332 12 01

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to