From:             norxh at binnews dot com
Operating system: Windows 2000
PHP version:      5.0.0
PHP Bug Type:     Network related
Bug description:  feof hangs on empty tcp stream

Description:
------------
When feof is called on an empty tcp stream opened by fsockopen, php will
hang indefinitely.

In adition to 5.0.0, I also tested with 5.0.x-dev (Jul 29, 2004 16:30 GMT)
and 5.1.x-dev (Jul 29, 2004 14:30 GMT). Each test was run with the cli
executable.

When attempting to debug this issue with Zend Studio 3.5, I found stopping
execution during this hang will cause php.exe or apache.exe to crash when
using local or remote debugging respectively.

Adding:
fwrite($stream, "GET / HTTP1.0\r\n\r\n");
before the call to feof will result in proper execution of the script.

Reproduce code:
---------------
<?
set_time_limit(15);
$stream = fsockopen('www.google.com', 80, $errno, $errstr, 5);
stream_set_timeout($stream, 5);
echo feof($stream) ? 'true':'false';
fclose($stream);
?>

Expected result:
----------------
false

Actual result:
--------------
hang

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

Reply via email to