Consider the umask setting when dumping a file.
This commit is contained in:
parent
be4255e5bc
commit
fdd266f28e
@ -554,8 +554,7 @@ class Filesystem
|
|||||||
throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
|
throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore for filesystems that do not support umask
|
@chmod($tmpFile, 0666 & ~umask());
|
||||||
@chmod($tmpFile, 0666);
|
|
||||||
$this->rename($tmpFile, $filename, true);
|
$this->rename($tmpFile, $filename, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1101,13 +1101,19 @@ class FilesystemTest extends FilesystemTestCase
|
|||||||
{
|
{
|
||||||
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
|
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
|
||||||
|
|
||||||
|
// skip mode check on Windows
|
||||||
|
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||||
|
$oldMask = umask(0002);
|
||||||
|
}
|
||||||
|
|
||||||
$this->filesystem->dumpFile($filename, 'bar');
|
$this->filesystem->dumpFile($filename, 'bar');
|
||||||
$this->assertFileExists($filename);
|
$this->assertFileExists($filename);
|
||||||
$this->assertSame('bar', file_get_contents($filename));
|
$this->assertSame('bar', file_get_contents($filename));
|
||||||
|
|
||||||
// skip mode check on Windows
|
// skip mode check on Windows
|
||||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||||
$this->assertFilePermissions(666, $filename);
|
$this->assertFilePermissions(664, $filename);
|
||||||
|
umask($oldMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user