Bug #70704 [NEW]: fputs

From: Date: Tue, 13 Oct 2015 00:58:38 +0000
Subject: Bug #70704 [NEW]: fputs
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196582@lists.php.net to get a copy of this message
From: euanmee at gmail dot com Operating system: Windows 7 Home Premium PHP version: 5.5.30 Package: Other web server Bug Type: Bug Bug description:fputs Description: ------------ PHP sometimes only writes part of the string to the disc. --- From manual page: http://www.php.net/function.fwrite --- I was originally using Mongoose Web Server - v5.5, with the PHP 5.5.10 supplied with it. I have now updated to 5.5.30 Three places in my code, I append data to a file. Occasionally, the first part of the write is not written, i.e. the write is not atomic. Windows 7 Home Premium, running Mongoose Web Server,using a Western Digital MyBookLive Duo (Debian + ext4) partition mounted as drive M: Test script: --------------- // from getBout.php $f = fopen("comps/$competitionId/$filename", "a"); // Write the new bout info fwrite($f, $toWrite); // Close the -status file fclose($f); // from getResults.php $f = fopen("comps/$competitionId/$filename", "a"); // Write the new bout info fwrite($f, $toWrite); // Close the -status file fclose($f); // from getScores.php $f = fopen("comps/$competitionId/$filename", "a"); // Write one bout's results fwrite($f, $toWrite); // fwrite($f, "boutScores[" . $currFencer2 . "][" . $currFencer1 . "] = " . $fencer2Num . ";\r\n") ; // Close the text file fclose($f); Expected result: ---------------- // from getBout.php, e.g. // Bout 2 currBout=2; currFencer1 = 3; currFencer2 = 4; // from getResults.php, e.g. /////////////////////////////////////////////////// // Bout 1 currBout=1; boutStartTimes[1] = '2015-10-12T07:47:58.401Z'; currFencer1 = 1; currFencer2 = 2; boutStarted[1][2] = true ; boutStarted[2][1] = true ; boutScores[1][2] = 3; boutScores[2][1] = 0; // from getScores.php, e.g. /////////////////////////////////////////////////// /////////////////////////////////////////////////// // Bout 1 over /////////////////////////////////////////////////// currBout=1; boutStartTimes[1] = '2015-10-12T07:47:58.401Z'; currFencer1 = 1; currFencer2 = 2; boutScores[1][2] = 10; boutScores[2][1] = 0; boutVictors[1][2] = 'V'; boutVictors[2][1] = 'L'; boutStarted[1][2] = true ; boutStarted[2][1] = true ; boutStartTimes[1] = '2015-10-12T07:47:58.401Z'; boutFinishTimes[1] = '2015-10-12T07:48:01.587Z'; /////////// /////////////// /////////// // from an earlier version e.g. currBout=1; boutStartTimes[1] = '2015-10-12T07:47:58.401Z'; Actual result: -------------- // from an earlier version e.g. 7:58.401Z'; // 37 characters missing from the intended string, in 0.03% of cases -- Edit bug report at https://bugs.php.net/bug.php?id=70704&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70704&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70704&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70704&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70704&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70704&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70704&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70704&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70704&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70704&r=support Expected behavior: https://bugs.php.net/fix.php?id=70704&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70704&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70704&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70704&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70704&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70704&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70704&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70704&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70704&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70704&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70704&r=mysqlcfg

« previous php.bugs (#196582) next »