|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24862 feof() never reports false
Submitted: 2003-07-29 18:13 UTC Modified: 2003-07-30 02:07 UTC
From: dasak36 at comcast dot net Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.3.2 OS: Windows XP pro
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: dasak36 at comcast dot net
New email:
PHP Version: OS:


 [2003-07-29 18:13 UTC] dasak36 at comcast dot net
I read a thread on this here at  It is the only one I can find of its kind.  The problem I am having is this.  Whenever I am reading the information from a socket like in the below code(which i got from the other post here):

$fp = fsockopen("localhost", 25);
stream_set_blocking($fp, false);
fwrite($fp, "QUIT\r\n");
while(!feof($fp)) {
  $data = fgets($fp);
echo "\nAll done\n";

The page hangs because feof($fp) never returns true.

I've been messing with this for a while but I cannot get this to work.  PHP version 4.3.2.



PS:  after I submitted this the site gave me other posts to check.  Some have the similar problem, but as before none were really answered.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-29 19:22 UTC]
Please try using this CVS snapshot:
For Windows:

The stream_set_blocking($fp, false); is not necessary.
 [2003-07-29 23:20 UTC] dasak36 at comcast dot net
Thank you.  It seems to work now, but it takes it a long time to find the end it seems.  Maybe i just need to set a timeout or somethin.

Thanks again,

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 08 01:05:45 2022 UTC