#43782 [Tbd->Opn]: feof() does not detect timeout on socket
From: jani@php.net Date: Tue, 25 Nov 2008 07:32:25 +0000 Subject: #43782 [Tbd->Opn]: feof() does not detect timeout on socket References: 1 Groups: php.doc.bugs Request: Send a blank email to doc-bugs+get-1538@lists.php.net to get a copy of this message
ID: 43782
Updated by: jani@php.net
Reported By: ml at foofree dot sk
-Status: To be documented
+Status: Open
-Bug Type: Streams related
+Bug Type: Documentation problem
Operating System: *
PHP Version: 5.2,5.3CVS (2008-07-15)
Previous Comments:
------------------------------------------------------------------------
[2008-11-24 15:38:52] dsp@php.net
The patch was reverted as it caused problems. We might want to edit the
documentation instead.
------------------------------------------------------------------------
[2008-08-26 16:06:45] dsp@php.net
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2008-01-08 01:19:23] ml at foofree dot sk
Description:
------------
From docs:
"Returns TRUE if the file pointer is at EOF or an error occurs
(including socket timeout); otherwise returns FALSE."
...
"If a connection opened by fsockopen() wasn't closed by the server,
feof() will wait until a timeout has been reached to return TRUE. The
default timeout value is 60 seconds. You may use stream_set_timeout() to
change this value."
feof() dows not wait and returns TRUE instead of FALSE if timeout
reached (server does not closed connection and there is no data in
timeout time slot).
* server does not closed connection,
* timeout wa reached
Reproduce code:
---------------
$s = stream_socket_client('tcp://www.php.net:80', $errno, $errstr, 10,
STREAM_CLIENT_CONNECT);
stream_set_timeout($s, 4);
$response = '';
while (feof($s) !== TRUE) {
if (($foo = @fread($s, 1024 * 8)) === FALSE) return NULL;
$response = $response . $foo;
};
print "OK";
Expected result:
----------------
prints "OK" approx. in 4 seconds
Actual result:
--------------
hangs forever
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43782&edit=1
Thread (6 messages)
- Unknown Message
- #43782 [Tbd->Opn]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Opn->Csd]: feof() does not detect timeout on socket
- Unknown Message
- #43782 [Tbd->Opn]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Opn->Csd]: feof() does not detect timeout on socket
- Unknown Message
- #43782 [Tbd->Opn]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Opn->Csd]: feof() does not detect timeout on socket
- Unknown Message
- #43782 [Tbd->Opn]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Opn->Csd]: feof() does not detect timeout on socket
- Unknown Message
- #43782 [Tbd->Opn]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Opn->Csd]: feof() does not detect timeout on socket
- Unknown Message
- #43782 [Tbd->Opn]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Com]: feof() does not detect timeout on socket
- #43782 [Opn->Csd]: feof() does not detect timeout on socket
| « previous | php.doc.bugs (#1538) | next » |
|---|