Bug #13086 Updated: fread design flaw

From: Date: Fri, 31 Aug 2001 23:28:11 +0000
Subject: Bug #13086 Updated: fread design flaw
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-64867@lists.php.net to get a copy of this message
ID: 13086 Updated by: rasmus Reported By: clarkbattle@hotmail.com Old Status: Open Status: Closed Bug Type: Feature/Change Request Operating System: win2k PHP Version: 4.0.6 New Comment: You mistakenly assume that the PHP strlen() function will stop counting at a NUL. That is not the case. It will correctly tell you the number of bytes, including NULs in a string. Previous Comments: ------------------------------------------------------------------------ [2001-08-31 19:24:43] clarkbattle@hotmail.com This is more of a design flaw than a bug. In C the fread() function returns the number of bytes read. In php it returns the string read. The C version is better. If you are reading binary data from a remote HTTP source and you need to know how much data you have read it is impossible with the PHP version. You cant read in a chunk then do a strlen() on the chunk because its binary and may contain null chars. read() seems to have the right interface but its experimental and only for sockets. ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=13086&edit=1

« previous php.dev (#64867) next »