#48472 [NEW]: fgets/fread behaviour on socket timeout undocumented

From: Date: Thu, 04 Jun 2009 16:27:20 +0000
Subject: #48472 [NEW]: fgets/fread behaviour on socket timeout undocumented
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2346@lists.php.net to get a copy of this message
From: nick dot telford at gmail dot com Operating system: CentOS 5.3 PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: fgets/fread behaviour on socket timeout undocumented 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 bug report at http://bugs.php.net/?id=48472&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48472&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48472&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48472&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48472&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48472&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48472&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48472&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48472&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48472&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48472&r=support Expected behavior: http://bugs.php.net/fix.php?id=48472&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48472&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48472&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48472&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48472&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48472&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48472&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48472&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48472&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48472&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48472&r=mysqlcfg

« previous php.doc.bugs (#2346) next »