From: mark at quarella dot co dot uk Operating system: Linux PHP version: 4.3.5RC3 PHP Bug Type: Filesystem function related Bug description: fread($fp,0) generates warning
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 bug report at http://bugs.php.net/?id=27461&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27461&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27461&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27461&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27461&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27461&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27461&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27461&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27461&r=support Expected behavior: http://bugs.php.net/fix.php?id=27461&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27461&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27461&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27461&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27461&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27461&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27461&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27461&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27461&r=float