Req #69057 [Com]: fread() should return bytes read count
| From: | grzegorz129 at gmail dot com | Date: | Sun, 15 Feb 2015 19:46:17 +0000 |
| Subject: | Req #69057 [Com]: fread() should return bytes read count | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-190703@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69057&edit=1
ID: 69057
Comment by: grzegorz129 at gmail dot com
Reported by: grzegorz129 at gmail dot com
Summary: fread() should return bytes read count
Status: Feedback
Type: Feature/Change Request
Package: Filesystem function related
Operating System: All
PHP Version: 5.6.5
Block user comment: N
Private report: N
New Comment:
Using strlen() adds additional overhead. Using it in fast running loops have significant impact on
performance, since function call is rather expensive operation (I'm talking about ~10Gb/s with
128KB chunks).
I see no point of not providing already available information. Unfortunately my PHP source knowledge
isn't good enough to reliable propose path.
Previous Comments:
------------------------------------------------------------------------
[2015-02-15 19:27:22] ab@php.net
strlen(fread(....)) ?
Thanks.
------------------------------------------------------------------------
[2015-02-15 15:15:37] grzegorz129 at gmail dot com
Description:
------------
PHP fread() should provide the same amount of informations as C fread().
fread() in C besides actual data also provides number of bytes read. PHP also implemented similar
behaviour but only for fwrite() function.
Changing returned value is of course not an option, but adding optional third parameter is.
Expected result:
----------------
Declaration of PHP fread() can be changed to:
string fread ( resource $handle , int $length [, int &$size ] )
Actual result:
--------------
Current declaration of fread() doesn't contain read bytes parameter.
string fread ( resource $handle , int $length )
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69057&edit=1