Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 61fe056

Browse filesBrowse files
committed
Merge branch '6.4' into 7.1
* 6.4: [Serializer] Fix for method named `get()` [Notifier][TurboSMS] Process partial accepted response from transport [HttpClient] Fix setting CURLMOPT_MAXCONNECTS throw a meaningful exception when parsing dotenv files with BOM [FrameworkBundle] Fix schema & finish incomplete tests for lock & semaphore config [Cache] Fix RedisSentinel params types [FrameworkBundle] Fix service reset between tests [Uid][Serializer][Validator] Mention RFC 9562 make sure temp files can be cleaned up on Windows
2 parents a9da7a3 + f810e3c commit 61fe056
Copy full SHA for 61fe056

File tree

Expand file treeCollapse file tree

2 files changed

+20
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-0
lines changed

‎Filesystem.php

Copy file name to clipboardExpand all lines: Filesystem.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,10 @@ public function dumpFile(string $filename, $content): void
673673
$this->rename($tmpFile, $filename, true);
674674
} finally {
675675
if (file_exists($tmpFile)) {
676+
if ('\\' === \DIRECTORY_SEPARATOR && !is_writable($tmpFile)) {
677+
self::box('chmod', $tmpFile, self::box('fileperms', $tmpFile) | 0200);
678+
}
679+
676680
self::box('unlink', $tmpFile);
677681
}
678682
}

‎Tests/FilesystemTest.php

Copy file name to clipboardExpand all lines: Tests/FilesystemTest.php
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,6 +1813,22 @@ public function testDumpKeepsExistingPermissionsWhenOverwritingAnExistingFile()
18131813
$this->assertFilePermissions(745, $filename);
18141814
}
18151815

1816+
public function testDumpFileCleansUpAfterFailure()
1817+
{
1818+
$targetFile = $this->workspace.'/dump-file';
1819+
$this->filesystem->touch($targetFile);
1820+
$this->filesystem->chmod($targetFile, 0444);
1821+
1822+
try {
1823+
$this->filesystem->dumpFile($targetFile, 'any content');
1824+
} catch (IOException $e) {
1825+
} finally {
1826+
$this->filesystem->chmod($targetFile, 0666);
1827+
}
1828+
1829+
$this->assertSame([$targetFile], glob($this->workspace.'/*'));
1830+
}
1831+
18161832
public function testReadFile()
18171833
{
18181834
$licenseFile = \dirname(__DIR__).'/LICENSE';

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.