From 45bbe43aac609e2b19633e1d838e5aa54567746b Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 2 Feb 2022 16:59:58 +0100 Subject: [PATCH] Fix case where symlink:true still can downgrade to a copy on windows, refs #10482 --- src/Composer/Downloader/PathDownloader.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Composer/Downloader/PathDownloader.php b/src/Composer/Downloader/PathDownloader.php index 9f8c62da6..97de3a6e0 100644 --- a/src/Composer/Downloader/PathDownloader.php +++ b/src/Composer/Downloader/PathDownloader.php @@ -272,6 +272,9 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter // Check we can use junctions safely if we are on Windows if (Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !$this->safeJunctions()) { + if (!in_array(self::STRATEGY_MIRROR, $allowedStrategies)) { + throw new \RuntimeException('You are on an old Windows / old PHP combo which does not allow Composer to use junctions/symlinks and this path repository has symlink:true in its options so copying is not allowed'); + } $currentStrategy = self::STRATEGY_MIRROR; $allowedStrategies = array(self::STRATEGY_MIRROR); }