#42057 [NEW]: fwrite() writes data into file when length is given as a negative value

From: Date: Sat, 21 Jul 2007 07:33:02 +0000
Subject: #42057 [NEW]: fwrite() writes data into file when length is given as a negative value
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115270@lists.php.net to get a copy of this message
From: kraghuba at in dot ibm dot com Operating system: RHEL 5 PHP version: 6CVS-2007-07-21 (CVS) PHP Bug Type: Filesystem function related Bug description: fwrite() writes data into file when length is given as a negative value Description: ------------ fwrite() writes given data to the file when length paramenter is given as a negative value. This is only applicable to php6. Reproduce code: --------------- <?php $fp = fopen("test.dat", "w"); $data = "data"; var_dump(fwrite($fp, $data, -10) ); fclose($fp); var_dump(readfile("test.dat") ); unlink("test.dat"); ?> Expected result: ---------------- int(0) int(0) Actual result: -------------- int(4) dataint(4) -- Edit bug report at http://bugs.php.net/?id=42057&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42057&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42057&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42057&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42057&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42057&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42057&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42057&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42057&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42057&r=support Expected behavior: http://bugs.php.net/fix.php?id=42057&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42057&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42057&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42057&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42057&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42057&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42057&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42057&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42057&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42057&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42057&r=mysqlcfg

« previous php.bugs (#115270) next »