This PR was merged into the 2.3 branch.
Discussion
----------
bug #14246 [Filesystem] dumpFile() non atomic
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #14246
| License | MIT
| Doc PR | none
Remove race condition where `dumpFile` has written the resulting file but has not given access yet.
Commits
-------
e4015d5
bug #14246 [Filesystem] dumpFile() non atomic
This commit is contained in:
commit
3aa30005f0
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue