ID: 27461 User updated by: mark at quarella dot co dot uk Reported By: mark at quarella dot co dot uk Status: Bogus Bug Type: Filesystem function related Operating System: Linux PHP Version: 4.3.5RC3 New Comment:
Sorry to be dumb but I can't find reference to the change in ChangeLog, NEWS, at php.net/fread - where should I be looking? (A Google for the text of the Warning message just shows up several sites running PHP which I guess have been broken by this change.) Previous Comments: ------------------------------------------------------------------------ [2004-03-02 12:39:59] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php This was a deliberate change. ------------------------------------------------------------------------ [2004-03-02 11:58:42] mark at quarella dot co dot uk Description: ------------ fread($handle, 0) generates a warning where it did not in earlier versions. This typically occurs in situations where the filesize is calculated: fread($handle, filesize($filename)); (where $handle is the result of opening file $filename, and $filename is the name of a zero-byte file) Reproduce code: --------------- // Taken from fread documentation, will generate WARNING // if something.txt exists and is empty (0 bytes) // get contents of a file into a string $filename = "/usr/local/something.txt"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); fclose($handle); Expected result: ---------------- Would expect $contents == '', no errors or warnings Actual result: -------------- Warning: fread(): Length parameter must be greater than 0. in xx on line yy ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27461&edit=1