[PHP-DEV] Bug #13086 Updated: fread design flaw From: rasmus <email protected>
Date: 08/31/01

ID: 13086
Updated by: rasmus
Reported By: clarkbattle <email protected>
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 <email protected>

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

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>