From fbf40edd3a180909da648073ef96a2585715b323 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Tue, 19 Jul 2022 16:52:03 +0100 Subject: [PATCH] Handle varying `composer -V` outputs (#43286) --- src/Illuminate/Support/Composer.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Illuminate/Support/Composer.php b/src/Illuminate/Support/Composer.php index 0571c6df465b..ab3f3e876b9f 100644 --- a/src/Illuminate/Support/Composer.php +++ b/src/Illuminate/Support/Composer.php @@ -123,6 +123,10 @@ public function getVersion() $output = $process->getOutput(); + if (preg_match('/(\d+(\.\d+){2})/', $output, $version)) { + return $version[1]; + } + return explode(' ', $output)[2] ?? null; } }