php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18626 socket functions crash apache
Submitted: 2002-07-29 13:41 UTC Modified: 2002-08-20 16:15 UTC
From: chregu@php.net Assigned:
Status: Closed Package: Sockets related
PHP Version: 4CVS-2002-07-29 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: chregu@php.net
New email:
PHP Version: OS:

 

 [2002-07-29 13:41 UTC] chregu@php.net
Hi

the following script crashes (segfaults) apache from time to time (1-2 out of 10). No idea what's wrong. The scripts works fine with PHP 4.2.2. backtrace appended.

System Info

- latest CVS
- Linux 2.4.18
- Apache 1.3.26

Script:

<?php

$url = parse_url($_GET["URL"]);
$url["host"] = "www.php.net";
$url["path"] = "/";
header("Content-type: text/xml");
$fp = fsockopen ($url["host"], 80, $errno, $errstr, 30);
fputs ($fp, "GET ".$url["path"]." HTTP/1.0\r\nHost: ".$url["host"]."\r\n\r\n");
while (!feof($fp)) {
	$line =  fgets ($fp,128);
	echo $line;
}
fclose ($fp);
?>

Backtrace:

#0  0x401159e0 in free () from /lib/libc.so.6
#1  0x40115983 in free () from /lib/libc.so.6
#2  0x4030a1e5 in _efree (ptr=0x8195214) at /opt/cvs/php4.3/Zend/zend_alloc.c:235
#3  0x402f8a0b in sapi_send_headers () at /opt/cvs/php4.3/main/SAPI.c:719
#4  0x40296c30 in php_header () at /opt/cvs/php4.3/ext/standard/head.c:57
#5  0x402ffc4b in php_ub_body_write (str=0x819785c "HTTP/1.0 200 OK\r\n", str_length=17)
    at /opt/cvs/php4.3/main/output.c:486
#6  0x402ff35e in php_body_write (str=0x819785c "HTTP/1.0 200 OK\r\n", str_length=17)
    at /opt/cvs/php4.3/main/output.c:101
#7  0x402f3429 in php_body_write_wrapper (str=0x819785c "HTTP/1.0 200 OK\r\n", str_length=17)
    at /opt/cvs/php4.3/main/main.c:810
#8  0x40318280 in zend_print_zval_ex (write_func=0x402f3408 <php_body_write_wrapper>, expr=0x8199ee4, 
    indent=0) at /opt/cvs/php4.3/Zend/zend.c:187
#9  0x40318221 in zend_print_zval (expr=0x8199ee4, indent=0) at /opt/cvs/php4.3/Zend/zend.c:168
#10 0x40317eac in zend_print_variable (var=0x8199ee4) at /opt/cvs/php4.3/Zend/zend_variables.c:138
#11 0x40326ccb in execute (op_array=0x819241c) at /opt/cvs/php4.3/Zend/zend_execute.c:1220
#12 0x403191ae in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /opt/cvs/php4.3/Zend/zend.c:810
#13 0x402f4706 in php_execute_script (primary_file=0xbffff868) at /opt/cvs/php4.3/main/main.c:1398
#14 0x4033108e in apache_php_module_main (r=0x818ec84, display_source_mode=0)
    at /opt/cvs/php4.3/sapi/apache/sapi_apache.c:55
#15 0x40331bae in send_php (r=0x818ec84, display_source_mode=0, filename=0x0)
    at /opt/cvs/php4.3/sapi/apache/mod_php4.c:553
#16 0x40331c12 in send_parsed_php (r=0x818ec84) at /opt/cvs/php4.3/sapi/apache/mod_php4.c:568
#17 0x08073c59 in ap_invoke_handler ()
#18 0x0808916f in process_request_internal ()
#19 0x080891d6 in ap_process_request ()
#20 0x0807fe66 in child_main ()
#21 0x08080021 in make_child ()
#22 0x0808019c in startup_children ()
#23 0x0808082d in standalone_main ()
#24 0x0808108c in main ()
#25 0x400c014f in __libc_start_main () from /lib/libc.so.6

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-20 16:15 UTC] chregu@php.net
It works with latest CVS...

chregu
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 02:01:29 2024 UTC