Skip to content

Commit

Permalink
[Filesystem] Strengthen the check of file permissions in dumpFile
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-daubois committed Apr 4, 2024
1 parent 899330a commit 6dc5233
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ public function dumpFile(string $filename, $content)
throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename);
}

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

$this->rename($tmpFile, $filename, true);
} finally {
Expand Down

0 comments on commit 6dc5233

Please sign in to comment.