From: [EMAIL PROTECTED] Operating system: PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: ftruncate doesn't move the file pointer
Description: ------------ Note or warning here? http://www.php.net/manual/en/function.ftruncate.php Reproduce code: --------------- <?php // truncate doesn't move the file pointer to the end of the file $flog = fopen("text.txt", "w+"); fwrite($flog, "veeery veeery long string"); fseek($flog, -2, SEEK_END); ftruncate($flog, 6); fwrite($flog, "shortstr"); fclose($flog); ?> Expected result: ---------------- 0000000000: 76 65 65 65 72 79 20 73 │ 68 6F 72 74 73 74 72 veeery shortstr Actual result: -------------- 0000000000: 76 65 65 65 72 79 20 00 │ 00 00 00 00 00 00 00 00 veeery 0000000010: 00 00 00 00 00 00 00 73 │ 68 6F 72 74 73 74 72 shortstr -- Edit bug report at http://bugs.php.net/?id=32889&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32889&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32889&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32889&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32889&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32889&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32889&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32889&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32889&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32889&r=support Expected behavior: http://bugs.php.net/fix.php?id=32889&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32889&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32889&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32889&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32889&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32889&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32889&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32889&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32889&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32889&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32889&r=mysqlcfg
