ID: 26863 Updated by: [EMAIL PROTECTED] Reported By: jim at bluedojo dot com -Status: Open +Status: Feedback Bug Type: *Directory/Filesystem functions Operating System: Windows XP PHP Version: 4.3.4 New Comment:
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); Previous Comments: ------------------------------------------------------------------------ [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