ID: 21529
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Open
+Status: Verified
Bug Type: Reproducible crash
Operating System: Linux RedHat 7.3 2.4.18
PHP Version: 4.3.0
Previous Comments:
------------------------------------------------------------------------
[2003-01-08 15:44:19] [EMAIL PROTECTED]
Script that cause crash:
<?php
/*
This script load hosts from file and try to connect with them
*/
$list = file('host.txt');
for ($i = 0; $i<count($list);$i++){
$data = explode(":",trim($list[$i]));
echo "Try ".$data[0]." on port ".$data[1]."\n";
$sock =
fsockopen($data[0],$data[1],&$errno,&$errstr,10);
if ($sock){
echo "Connected on ".trim($list[$i])."\n";
exec("echo ".trim($list[$i])." >> pro.log");
fclose($sock);
}
}
?>
Configure line:
./configure --enable-ftp --with-gd --with-zlib --enable-calendar
--enable-trans-sid --enable-xslt=/usr/lib
--with-apxs=/usr/local/apache/bin/apxs --enable-sigchild --with-xml
--with-expat=/usr/lib --with-xslt-sablot=/usr/lib --with-mysql=/usr
--enable-pcntl --without-pear
php.ini
Default setting excepted the include_path
gdb:
(gdb) bt
#0 0x08114a32 in php_sockop_close (stream=0x81f316c, close_handle=1)
at /usr/src/redhat/SOURCES/php-4.3.0/main/network.c:996
#1 0x081111d1 in _php_stream_free (stream=0x81f316c, close_options=3)
at /usr/src/redhat/SOURCES/php-4.3.0/main/streams.c:327
#2 0x080ad98b in zif_fclose (ht=1, return_value=0x81f30fc,
this_ptr=0x0, return_value_used=0)
at /usr/src/redhat/SOURCES/php-4.3.0/ext/standard/file.c:1120
#3 0x08141bd4 in execute (op_array=0x81f0a44) at
/usr/src/redhat/SOURCES/php-4.3.0/Zend/zend_execute.c:1596
#4 0x0812f7e4 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /usr/src/redhat/SOURCES/php-4.3.0/Zend/zend.c:864
#5 0x081096ed in php_execute_script (primary_file=0xbffffa30) at
/usr/src/redhat/SOURCES/php-4.3.0/main/main.c:1573
#6 0x0814b12c in main (argc=3, argv=0xbffffad4) at
/usr/src/redhat/SOURCES/php-4.3.0/sapi/cli/php_cli.c:746
#7 0x42017589 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) frame 3
#3 0x08141bd4 in execute (op_array=0x81f0a44) at
/usr/src/redhat/SOURCES/php-4.3.0/Zend/zend_execute.c:1596
1596
((zend_internal_function *)
EX(function_state).function)->handler(EX(opline)->extended_value,
EX(Ts)[EX(opline)->result.u.var].var.ptr, EX(object).ptr,
return_value_used TSRMLS_CC);
(gdb)
Note:
This is a only command line script
I've try to recompile whith --enable-debug but in this case i have not
crash.
The host in the host file are 541.
Output example:
[fra@ebmserver fra]# php -q script.php
Try xxxx-xxxx.com.xx on port 80
Connected on xx.xx.xx-18.xxx.xx.xx:80
Try xxx.5xx.xx.2xx on port 80
Connected on 1xx.xx.xx.xx:80
Try xx.kxxi.xx on port 80
Connected on wxx.xxi.is:80
Try xximv.axxu.xxx on port 80
Warning: fsockopen() [http://www.php.net/function.fsockopen]:
php_network_getaddresses: getaddrinfo failed: Name or service not known
in /fra/script.php on line 7
Warning: fsockopen() [http://www.php.net/function.fsockopen]: unable to
connect to xxx.xxxau.xx:80 in /fra/script.php on line 7
Try 13xx.2xx8.xx1.xx on port 8080
Warning: fsockopen() [http://www.php.net/function.fsockopen]:
php_hostconnect: connect failed in /fra/script.php on line 7
Warning: fsockopen() [http://www.php.net/function.fsockopen]: unable to
connect to 1xxx.x.xx.xxx:8080 in /fra/script.php on line 7
Try wesxxxu.xx.texxxa.xx on port 80
Connected on wexxxu.lxxk.telxxxra.net:80
Try sexxer.clarxxyota.xxx on port 80
Connected on sexxxver.xxxarkxxxxta.com:80
Try nxxx2.rxxxa.cxxa on port 80
Connected on xx2.rxxa.cx:80
Segmentation fault (core dumped)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21529&edit=1