From 040a9abdbfae6c4c068d7d4a202ccf2f87139e04 Mon Sep 17 00:00:00 2001 From: ChS Date: Wed, 1 Mar 2017 19:26:18 +0100 Subject: [PATCH] dumpFile(), preserve existing file permissions --- src/Symfony/Component/Filesystem/Filesystem.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index a1ff41e892..16d83dc2e5 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -516,7 +516,10 @@ class Filesystem } $this->chmod($tmpFile, $mode); + } else { + @chmod($tmpFile, file_exists($filename) ? fileperms($filename) : 0666 & ~umask()); } + $this->rename($tmpFile, $filename, true); }