Skip to content

Commit

Permalink
Merge pull request #30 from uWaterloo/fopen-append
Browse files Browse the repository at this point in the history
Use append-only mode in fopen()
  • Loading branch information
jhedstrom authored Mar 25, 2020
2 parents e211938 + 2fb3919 commit 9f13a21
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Writer/Drupal.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function rewrite($version, $timestamp, $core = null, $project = null)
foreach ($this->paths as $info_file) {
// Don't write to files that already contain version information.
if (!$this->hasVersionInfo($info_file)) {
$file = fopen($info_file, 'a+');
$file = fopen($info_file, 'a');
$coreToWrite = $this->hasCoreVersionRequirement($info_file) ? null : $core;
fwrite($file, $this->formatInfo($version, $timestamp, $coreToWrite, $project));
fclose($file);
Expand Down
2 changes: 1 addition & 1 deletion tests/DrupalInfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public function testRollbackRewrite()
timestamp: 1234
EOL;
foreach ($files as $file) {
$handle = fopen($file, 'a+');
$handle = fopen($file, 'a');
fwrite($handle, $info_pattern);
fclose($handle);
$this->assertContains($info_pattern, file_get_contents($file));
Expand Down

0 comments on commit 9f13a21

Please sign in to comment.