From:             labsy at seznam dot org
Operating system: Windows 2000/XP
PHP version:      5.0.2
PHP Bug Type:     Sockets related
Bug description:  fsockopen does not timeout on bogus desination

Description:
------------
This bug has been reported 2 years ago, but it is still present in last
5.0.2 version.
PHP installed on Windows 2000 server or on Windows XP, all with latest
service packs. PHP run as ISAPI.

HOW TO TEST:
For destination IP $domain in my script, please use some remote machine
with IIS 5.0 or IIS 5.1.
Try the script and it should pass.
Now, on REMOTE machine, go and crash IIS service. For example, you may
crash it for sure this way:
- install PHP on remotemachine as ISAPI
- in PHP.INI enable some extension, which does not exist - try
php_pdf.dll
- start IIS and IIS should hang

Now, run the script again to test hanged IIS machine. Script should exit
with FATAL ERROR or in worst case, with IIS hang on your first machine.

Reproduce code:
---------------
<?php
$domain = ""; //enter some IP - see instructions below!
$port = "80";
$fp = fsockopen($domain,$port,$errno,$errstr,2) ;
if (!$fp){
             $output = '<br>SOCKET: '.$domain.':'.$port.' FAILED
responding!';
} else {
             $output = '<br>SOCKET: '.$domain.':'.$port.' responded OK';
             fclose($fp);
}
?>



Expected result:
----------------
fsockopen() should return TRUE or FALSE, but in any case it should exit
within set TIMEOUT value (which is 2 seconds in this case).

Actual result:
--------------
In case that destination socket is IIS and it is CRASHED or HANGED, the
script will not terminate after 2 seconds, but will try open socket until
PHP timeout occures.
And additionally - in some cases, if PHP is run on IIS 5.0 or 5.1, script
may HANG and LOCK IIS so you need to restart machine. W3SVC stops
responding.

-- 
Edit bug report at http://bugs.php.net/?id=30374&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30374&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30374&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30374&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30374&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30374&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30374&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30374&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30374&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30374&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30374&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30374&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30374&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30374&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30374&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30374&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30374&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30374&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30374&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30374&r=mysqlcfg

Reply via email to