note 33020 deleted from function.fread by wez
| From: | wez@php.net | Date: | Fri, 13 Jun 2003 23:22:42 +0000 |
| Subject: | note 33020 deleted from function.fread by wez | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-50316@lists.php.net to get a copy of this message | ||
Note Submitter: Bob Silva
----
[ Editor's Note: This was done to prevent streams from aggresively blocking. Aggresive
blocking is most obvious when using UDP streams and a script expects a single packet of unknown
length. It's important to note that the documented functionality of the function has not
changed. It reads UP TO 'length' bytes. This is NOT to say that it will always read
'length' bytes. ]
As of 4.3.2, the functionality of fread has changed in regards to sockets and url wrappers. You can
no longer read $length bytes from the file pointer. There is a note in the documentation above which
shows you what you have to do.
Even though I read that, it didnt click because who would think that a long time PHP function like
this would change in functionality and the only indication is a Note: in the docs.
When fread()'ing a network connection, you must loop the fread() to read in all the data one
packet at a time.
Forcing PHP scripts to wrap this sort of low-level programming around what was previously a
perfectly useful high-level function defeats the whole purpose of a scripting language and was
irresponsible to say the least.