Unverified Commit aa05014a authored by alexpott's avatar alexpott
Browse files

Issue #3221507 by mxr576: mkdir can fail in...

Issue #3221507 by mxr576: mkdir can fail in Drupal\TestTools\PhpUnitCompatibility\PhpUnit8::flushAlteredCodeToFile() because of a race condition

(cherry picked from commit d54ee303)
parent 31d2dc98
......@@ -109,8 +109,8 @@ private static function flushAlteredCodeToFile(string $file_name, string $altere
// Only write when necessary.
if (!file_exists($full_path) || md5_file($full_path) !== md5($altered_code)) {
// Create directory when necessary.
if (!file_exists($directory)) {
mkdir($directory, 0777, TRUE);
if (!is_dir($directory) && !@mkdir($directory, 0777, TRUE) && !is_dir($directory)) {
throw new \RuntimeException('Unable to create directory: ' . $directory);
}
file_put_contents($full_path, $altered_code);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment