Fix creation of a php: dir when running create-project, fixes #8849

main
Jordi Boggiano 4 years ago
parent fc8be2bed8
commit 4ce3836f51
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -112,11 +112,17 @@ class JsonFile
*/
public function write(array $hash, $options = 448)
{
if ($this->path === 'php://memory') {
file_put_contents($this->path, static::encode($hash, $options));
return;
}
$dir = dirname($this->path);
if (!is_dir($dir)) {
if (file_exists($dir)) {
throw new \UnexpectedValueException(
$dir.' exists and is not a directory.'
realpath($dir).' exists and is not a directory.'
);
}
if (!@mkdir($dir, 0777, true)) {

Loading…
Cancel
Save