#48472 [Opn->Bgs]: fgets/fread behaviour on socket timeout undocumented
| From: | vrana@php.net | Date: | Mon, 16 Nov 2009 13:37:39 +0000 |
| Subject: | #48472 [Opn->Bgs]: fgets/fread behaviour on socket timeout undocumented | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-3192@lists.php.net to get a copy of this message | ||
ID: 48472
Updated by: vrana@php.net
Reported By: nick dot telford at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
Operating System: CentOS 5.3
PHP Version: Irrelevant
New Comment:
Already documented: "When the stream times out, ... no error/warning is
generated."
Previous Comments:
------------------------------------------------------------------------
[2009-06-04 16:28:28] nick dot telford at gmail dot com
Forgot to mention. Bug #31897 seems related but slightly different - as
it was fixed and closed when the docs about having to check
stream_get_meta_data() was added to stream_set_timeout().
------------------------------------------------------------------------
[2009-06-04 16:27:20] nick dot telford at gmail dot com
Description:
------------
When using stream_set_timeout() to set a timeout on a stream it is
documented that you need to check stream_get_meta_data() to see if the
stream timed out. However, the behaviour of fgets/fread (in blocking
mode) when the socket times out is not documented.
At first, I assumed that the time out would be considered a "failure",
which is documented in both fread and fgets as returning FALSE.
However, after testing, it appears that both methods return an empty
string when the socket times out. This is fine, because you can check to
see if this was because of an EOF (using feof) or a timeout
(stream_get_meta_data) after the method has returned.
The only problem here is a lack of descriptive documentation. The
behaviour of blocking read functions when the stream times out needs to
be documented as this is a common scenario when working with socket
streams.
Regards,
Nicholas Telford
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48472&edit=1