Skip to content

Commit e18d2ad

Browse files
committed
minor symfony#13645 fixed possible race condition when creating a directory (fabpot)
This PR was merged into the 2.3 branch. Discussion ---------- fixed possible race condition when creating a directory | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#13228 | License | MIT | Doc PR | n/a Commits ------- 8542866 fixed possible race condition when creating a directory
2 parents ee47901 + 8542866 commit e18d2ad

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
666666

667667
if ('file' === $config['cache']) {
668668
$cacheDir = $container->getParameterBag()->resolveValue($config['file_cache_dir']);
669-
if (!is_dir($cacheDir) && false === @mkdir($cacheDir, 0777, true)) {
669+
if (!is_dir($cacheDir) && false === @mkdir($cacheDir, 0777, true) && !is_dir($cacheDir)) {
670670
throw new \RuntimeException(sprintf('Could not create cache directory "%s".', $cacheDir));
671671
}
672672

src/Symfony/Component/HttpFoundation/File/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function move($directory, $name = null)
130130
protected function getTargetFile($directory, $name = null)
131131
{
132132
if (!is_dir($directory)) {
133-
if (false === @mkdir($directory, 0777, true)) {
133+
if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) {
134134
throw new FileException(sprintf('Unable to create the "%s" directory', $directory));
135135
}
136136
} elseif (!is_writable($directory)) {

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ protected function buildContainer()
605605
{
606606
foreach (array('cache' => $this->getCacheDir(), 'logs' => $this->getLogDir()) as $name => $dir) {
607607
if (!is_dir($dir)) {
608-
if (false === @mkdir($dir, 0777, true)) {
608+
if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
609609
throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir));
610610
}
611611
} elseif (!is_writable($dir)) {

0 commit comments

Comments
 (0)