|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29449 feof hangs on empty tcp stream
Submitted: 2004-07-29 20:31 UTC Modified: 2004-07-31 22:47 UTC
From: norxh at binnews dot com Assigned:
Status: Closed Package: Network related
PHP Version: 5.0.0 OS: Windows 2000
Private report: No CVE-ID:
 [2004-07-29 20:31 UTC] norxh at binnews dot com
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.

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

Reproduce code:
$stream = fsockopen('', 80, $errno, $errstr, 5);
stream_set_timeout($stream, 5);
echo feof($stream) ? 'true':'false';

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-29 21:23 UTC] norxh at binnews dot com
Verified that this does not happen on Linux.
OS: Red Hat Enterprise Linux ES release 3
PHP: 5.0.0
 [2004-07-31 13:56 UTC]
Please try using this CVS snapshot:
For Windows:

Please try next snapshot dated after this message.
 [2004-07-31 22:45 UTC] norxh at binnews dot com
Okay, I tried the latest builds.

Linux: Still works fine.
Windows 2000: Works perfectly now.

Thanks Wez. 

PHP5 is shaping up very nicely :)
 [2004-07-31 22:47 UTC] norxh at binnews dot com
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Tue Oct 13 13:01:30 2015 UTC