#26863 [NEW]: fgets hangs on some urls
| From: | jim at bluedojo dot com | Date: | Sat, 10 Jan 2004 21:56:57 +0000 |
| Subject: | #26863 [NEW]: fgets hangs on some urls | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-53072@lists.php.net to get a copy of this message | ||
From: jim at bluedojo dot com
Operating system: Windows XP
PHP version: 4.3.4
PHP Bug Type: *Directory/Filesystem functions
Bug description: fgets hangs on some urls
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 bug report at http://bugs.php.net/?id=26863&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26863&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26863&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26863&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26863&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26863&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26863&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26863&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26863&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26863&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26863&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26863&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26863&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26863&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26863&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26863&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26863&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26863&r=float