ID:               26863
 User updated by:  jim at bluedojo dot com
 Reported By:      jim at bluedojo dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         *Directory/Filesystem functions
 Operating System: Windows XP
 PHP Version:      4.3.4
 New Comment:

The url is now working now so I cannot use it as a test case (it needs
to return false).  I will see if I can find a new url to test it with
the new code.


Previous Comments:
------------------------------------------------------------------------

[2004-01-10 17:35:18] [EMAIL PROTECTED]

I suspect the problem to be with feof() rather than fgets().

try this:

do {
   $line = fgets($fp);
   if ($line === false)
      break;
   $html .= trim($line);
} while(true);


------------------------------------------------------------------------

[2004-01-10 17:27:29] jim at bluedojo dot com

I used the latest snapshot.  fgets() still hangs on that specific url
and stream_set_timeout does not time out.  It should return false but
doesn't.

------------------------------------------------------------------------

[2004-01-10 17:18:20] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

------------------------------------------------------------------------

[2004-01-10 16:56:56] jim at bluedojo dot com

Description:
------------
fgets() hangs infintely on some urls.

This url:  http://www.nwf.org/productions/whales.html

will not do anything and should return false when I use
stream_set_timeout() but it doesn't time out.

I tried fgets($fd, 1024) and fgets($fd, 4096) but that doesn't work
either.

Reproduce code:
---------------
$url = http://www.nwf.org/productions/whales.html;

if ($fd = @fopen($url,'rb')){
   stream_set_timeout($fd, 6);
   $html = '';
   while (!feof($fd)) {
      $html .= trim(fgets($fd));
   }
   
   fclose($fd);
}

Expected result:
----------------
The code should store the html code of "$url" into "$html."  But it
hangs on some urls when it should return false due to
stream_set_timeout();

Actual result:
--------------
fgets() Hangs infinitely.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=26863&edit=1

Reply via email to