Avoid race condition

This commit is contained in:
Alessandro Lai 2017-12-22 10:16:23 +01:00 committed by Adrien Crivelli
parent a653e09bf0
commit b5057f44b1
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
1 changed files with 3 additions and 1 deletions

View File

@ -141,7 +141,9 @@ class Sample
{
$tempFolder = sys_get_temp_dir() . '/phpspreadsheet';
if (!is_dir($tempFolder)) {
mkdir($tempFolder);
if (! mkdir($tempFolder) && ! is_dir($tempFolder)) {
throw new \RuntimeException(sprintf('Directory "%s" was not created', $tempFolder));
}
}
return $tempFolder;