From 4ce3836f512d7d0b86cd563e15f5d0d0c607159f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 1 May 2020 17:23:32 +0200 Subject: [PATCH] Fix creation of a php: dir when running create-project, fixes #8849 --- src/Composer/Json/JsonFile.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index d1d189287..1e30690c1 100644 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -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)) {