8000 [Filesystem] Strengthen the check of file permissions in `dumpFile` · symfony/symfony@0c17a4e · GitHub
[go: up one dir, main page]

Skip to content

Commit 0c17a4e

Browse files
[Filesystem] Strengthen the check of file permissions in dumpFile
1 parent 50268e6 commit 0c17a4e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ public function dumpFile(string $filename, $content)
691691
throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename);
692692
}
693693

694-
self::box('chmod', $tmpFile, file_exists($filename) ? fileperms($filename) : 0666 & ~umask());
694+
self::box('chmod', $tmpFile, @fileperms($filename) ?: 0666 & ~umask());
695695

696696
$this->rename($tmpFile, $filename, true);
697697
} finally {

0 commit comments

Comments
 (0)
0