From: alan at ridersite dot org
Operating system: BSD
PHP version: 4.3.10
PHP Bug Type: Sockets related
Bug description: stream_set_timeout() appears to do nothing of value
Description:
------------
It appears to me that stream_set_timout() does not do anything of value.
You can set it prior to a while loop; but, it does nothing to help you
exit the loop if the time expires. e.g.,
stream_set_timeout($fp, 20);
$status = socket_get_status($fp);
while (!feof($fp) && !$status['timed_out']) {
$chunk = fread($fp, 10000);
$length = strlen($chunk);
$html_str .= $chunk;
sleep(2);
$status = socket_get_status($fp);
} //end while, fetching data
If fread() hangs up, the script hangs.
You can do exactly the same thing by simply keeping track of elapsed time
in the loop.
Set stream_set_blocking($fp, FALSE ) so fread() keeps going and the loop
continues until the elapsed time expires.
--
Edit bug report at http://bugs.php.net/?id=32058&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32058&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32058&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32058&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32058&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32058&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32058&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32058&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32058&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32058&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32058&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32058&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32058&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32058&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32058&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32058&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32058&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32058&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32058&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32058&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32058&r=mysqlcfg