From 803e4e5dbda1c84c0937c87993848e078680343e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 25 Oct 2022 15:04:08 +0200 Subject: [PATCH] Catch runtime exception while initializing Composer to make sure a missing composer.json does not fail >tryComposer, refs #11133 --- src/Composer/Console/Application.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 635fb04d3..743c07235 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -17,6 +17,7 @@ use Composer\Util\Filesystem; use Composer\Util\Platform; use Composer\Util\Silencer; use LogicException; +use RuntimeException; use Seld\Signal\SignalHandler; use Symfony\Component\Console\Application as BaseApplication; use Symfony\Component\Console\Exception\CommandNotFoundException; @@ -512,6 +513,10 @@ class Application extends BaseApplication if ($required) { throw $e; } + } catch (RuntimeException $e) { + if ($required) { + throw $e; + } } }