Browse Source

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

Jordi Boggiano 4 years ago
parent
commit
4ce3836f51
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/Composer/Json/JsonFile.php

+ 7 - 1
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)) {