Req #69057 [Fbk]: fread() should return bytes read count

From: Date: Sun, 15 Feb 2015 20:07:41 +0000
Subject: Req #69057 [Fbk]: fread() should return bytes read count
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190704@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 Updated by: ab@php.net 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: From that perspective, yes. But please post some PHP code to illustrate this. Do you need this to show something like process progress? Just not sure one would really need this. Normally, even with the big amount of data, it's enough to check the whole size at the end. Thanks. Previous Comments: ------------------------------------------------------------------------ [2015-02-15 19:46:17] grzegorz129 at gmail dot com 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#190704) next »