Re: fread($fp, 0);

From: Date: Fri, 30 Apr 2004 20:29:19 +0000
Subject: Re: fread($fp, 0);
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-9621@lists.php.net to get a copy of this message
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:
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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.internals (#9621) next »