fread($fp, 0);

php.internals

Derick Rethans

22 years ago
Hello, what was the rationale behind throwing a warning for the snippet in the topic? Warning: fread(): Length parameter must be greater than 0. in /usr/local/lib/php/PEAR/Common.php on line 1296 This breaks often used code where the filesize is 0, like: $f = fopen('file', 'r'); $contents = fread($f, filesize('file')); And I don't really see the point of throwing a warning here. Derick

Zeev Suraski

22 years ago
The CVS update read: Fixed bug #26752 (Silent unterminated loop when length parameter for fgets(), fread() and fgetss() is 0). (done by Ilia January 2nd this year) I tend to agree that this was a bad idea, and suggest to restore the old check. Unless I'm missing something, bug #26752 wasn't a bug in PHP but in the reporter's code. Zeev At 23:18 30/04/2004, Derick Rethans wrote: