diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index 5e90e09f3..7ddcfa69f 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -251,10 +251,13 @@ class Filesystem $directory.' exists and is not a directory.' ); } + + if (is_link($directory) && !@$this->unlinkImplementation($directory)) { + throw new \RuntimeException('Could not delete symbolic link '.$directory.': '.(error_get_last()['message'] ?? '')); + } + if (!@mkdir($directory, 0777, true)) { - throw new \RuntimeException( - $directory.' does not exist and could not be created.' - ); + throw new \RuntimeException($directory.' does not exist and could not be created: '.(error_get_last()['message'] ?? '')); } } }