#48946 [NEW]: fgets hangs on fsockeopen stream
| From: | trutas dot ctx at gmail dot com | Date: | Thu, 16 Jul 2009 14:04:26 +0000 |
| Subject: | #48946 [NEW]: fgets hangs on fsockeopen stream | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-139819@lists.php.net to get a copy of this message | ||
From: trutas dot ctx at gmail dot com
Operating system: Windows Server 2003 x64 IIS6.0
PHP version: 5.3.0
PHP Bug Type: IIS related
Bug description: fgets hangs on fsockeopen stream
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 bug report at http://bugs.php.net/?id=48946&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48946&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48946&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48946&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48946&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48946&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48946&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48946&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48946&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48946&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48946&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48946&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48946&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48946&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48946&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48946&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48946&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48946&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48946&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48946&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48946&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48946&r=mysqlcfg