ID: 48946 Updated by: j...@php.net Reported By: trutas dot ctx at gmail dot com -Status: Open +Status: Bogus Bug Type: IIS related Operating System: Windows Server 2003 x64 IIS6.0 PHP Version: 5.3.0 New Comment:
You should actually check if there was timeout in your loop. RTFM at http://php.net/stream_set_timeout tells: "When the stream times out, the 'timed_out' key of the array returned by stream_get_meta_data() is set to TRUE, although no error/warning is generated." Previous Comments: ------------------------------------------------------------------------ [2009-07-16 14:04:26] trutas dot ctx at gmail dot com Description: ------------ fgets() hangs up to script timeout (60secs) on an opened fsockopen stream. stream_set_timeout is set for 30 secs - but apparently does nothing. For now i'll try to work around it using curl and the intranet squid proxy server. Reproduce code: --------------- $fp = fsockopen("intranet.mydomain.net", 443, $errno, $errstr, 30); if($fp) { if(fputs($fp, $headers, strlen($headers))){ $result = ''; stream_set_timeout($fp, 30); //should timeout in 30 secs while(!feof($fp)) { $result .=fgets($fp, 4096); //scripts hangs up to script timeout in this line } fclose($fp); print $result; } } Expected result: ---------------- $result gets printed or error gets thrown out somewhere. Actual result: -------------- Maximum execution time of 60 seconds exceeded in... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48946&edit=1