This PR was squashed before being merged into the 2.3 branch (closes #11726).
Discussion
----------
[Filesystem Component] mkdir race condition fix #11626
[Filesystem Component] Fix mkdir race condition
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #11626
| License | MIT
| Doc PR | none
Commits
-------
0483452
[Filesystem Component] mkdir race condition fix #11626
This commit is contained in:
commit
bb97903684
@ -78,7 +78,14 @@ class Filesystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (true !== @mkdir($dir, $mode, true)) {
|
if (true !== @mkdir($dir, $mode, true)) {
|
||||||
throw new IOException(sprintf('Failed to create %s', $dir));
|
$error = error_get_last();
|
||||||
|
if (!is_dir($dir)) {
|
||||||
|
// The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one
|
||||||
|
if ($error) {
|
||||||
|
throw new IOException(sprintf('Failed to create "%s": %s.', $dir, $error['message']));
|
||||||
|
}
|
||||||
|
throw new IOException(sprintf('Failed to create "%s"', $dir));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user