From e4015d5cc323feb912188a30d4400382d9d96e33 Mon Sep 17 00:00:00 2001 From: Hidde Boomsma Date: Thu, 31 Dec 2015 09:33:31 +0100 Subject: [PATCH] bug #14246 [Filesystem] dumpFile() non atomic --- src/Symfony/Component/Filesystem/Filesystem.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 1b6eaa68cd..eca36bff19 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -477,9 +477,9 @@ class Filesystem throw new IOException(sprintf('Failed to write file "%s".', $filename)); } - $this->rename($tmpFile, $filename, true); if (null !== $mode) { - $this->chmod($filename, $mode); + $this->chmod($tmpFile, $mode); } + $this->rename($tmpFile, $filename, true); } }