bug #21823 dumpFile(), preserve existing file permissions (chs2)
This PR was squashed before being merged into the 2.7 branch (closes #21823).
Discussion
----------
dumpFile(), preserve existing file permissions
When calling Filesystem::dumpFile() on an already existing file, its permissions are lost.
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
<!--
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->
Commits
-------
040a9abdbf
dumpFile(), preserve existing file permissions
This commit is contained in:
commit
c91db73fbb
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user