From bbd2c9613e9359480173a4504488327bb1e22347 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 30 Aug 2023 11:19:47 +0200 Subject: [PATCH] Fix uncaught promises when doing synchronous file downloads that fail, fixes #11563 --- src/Composer/Util/HttpDownloader.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Composer/Util/HttpDownloader.php b/src/Composer/Util/HttpDownloader.php index e4034d2ae..e4b26d24b 100644 --- a/src/Composer/Util/HttpDownloader.php +++ b/src/Composer/Util/HttpDownloader.php @@ -107,7 +107,10 @@ class HttpDownloader if ('' === $url) { throw new \InvalidArgumentException('$url must not be an empty string'); } - [$job] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => null], true); + [$job, $promise] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => null], true); + $promise->catch(function (\Throwable $e) { + // suppress error as it is rethrown to the caller by getResponse() a few lines below + }); $this->wait($job['id']); $response = $this->getResponse($job['id']);