10000 bug #21200 [Filesystem] Check that directory is writable after create… · symfony/symfony@e18f47f · GitHub
[go: up one dir, main page]

Skip to content

Commit e18f47f

Browse files
committed
bug #21200 [Filesystem] Check that directory is writable after created it in dumpFile() (chalasr)
This PR was merged into the 2.7 branch. Discussion ---------- [Filesystem] Check that directory is writable after created it in dumpFile() | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20612 (comment) | License | MIT | Doc PR | n/a In case permissions have been changed meanwhile Commits ------- dbc4148 [Filesystem] Check that the directory is writable after created it in dumpFile()
2 parents 182dd8f + dbc4148 commit e18f47f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,9 @@ public function dumpFile($filename, $content, $mode = 0666)
498498

499499
if (!is_dir($dir)) {
500500
$this->mkdir($dir);
501-
} elseif (!is_writable($dir)) {
501+
}
502+
503+
if (!is_writable($dir)) {
502504
throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
503505
}
504506

0 commit comments

Comments
 (0)
0