ID: 29449
User updated by: norxh at binnews dot com
Reported By: norxh at binnews dot com
Status: Open
Bug Type: Network related
Operating System: Windows 2000
PHP Version: 5.0.0
New Comment:
Verified that this does not happen on Linux.
OS: Red Hat Enterprise Linux ES release 3
PHP: 5.0.0
Previous Comments:
------------------------------------------------------------------------
[2004-07-29 20:31:09] norxh at binnews dot com
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 this bug report at http://bugs.php.net/?id=29449&edit=1