Skip to content

Commit e4015d5

Browse files
author
Hidde Boomsma
committed
bug symfony#14246 [Filesystem] dumpFile() non atomic
1 parent 6b13708 commit e4015d5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,9 @@ public function dumpFile($filename, $content, $mode = 0666)
477477
throw new IOException(sprintf('Failed to write file "%s".', $filename));
478478
}
479479

480-
$this->rename($tmpFile, $filename, true);
481480
if (null !== $mode) {
482-
$this->chmod($filename, $mode);
481+
$this->chmod($tmpFile, $mode);
483482
}
483+
$this->rename($tmpFile, $filename, true);
484484
}
485485
}

0 commit comments

Comments
 (0)