From 1bb87babe62a485e4d57d025e4b29e84f69e47d6 Mon Sep 17 00:00:00 2001 From: Chauncey McAskill Date: Thu, 15 Oct 2020 16:11:16 -0400 Subject: [PATCH] Fix availability of $urls in FileDownloader Fixed: - Ensure manipulations to the first element of $urls in the $download callback are available in $accept and $reject --- src/Composer/Downloader/FileDownloader.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index 45c977bf4..ece83a104 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -142,6 +142,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface $reject = null; $download = function () use ($io, $output, $httpDownloader, $cache, $cacheKeyGenerator, $eventDispatcher, $package, $fileName, &$urls, &$accept, &$reject) { $url = reset($urls); + $index = key($urls); if ($eventDispatcher) { $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $httpDownloader, $url['processed'], 'package', $package); @@ -154,6 +155,8 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface $url['processed'] = $preFileDownloadEvent->getProcessedUrl(); } + $urls[$index] = $url; + $checksum = $package->getDistSha1Checksum(); $cacheKey = $url['cacheKey'];