From 33cdf6bf41d1c301d30cc80887e38249acb5c0b7 Mon Sep 17 00:00:00 2001 From: Jorick Pepin Date: Fri, 5 Jun 2026 16:33:57 +0200 Subject: [PATCH] Fix `null as array offset` when running composer without command --- src/Flex.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Flex.php b/src/Flex.php index 6c53270a..f6481d34 100644 --- a/src/Flex.php +++ b/src/Flex.php @@ -162,6 +162,7 @@ class_exists(__NAMESPACE__.str_replace('/', '\\', substr($file, \strlen(__DIR__) $resolver = new PackageResolver($this->downloader); + $command = null; $commandObj = null; try { $command = $input->getFirstArgument(); @@ -180,7 +181,7 @@ class_exists(__NAMESPACE__.str_replace('/', '\\', substr($file, \strlen(__DIR__) $symfonyRequire = null; } - if (isset(self::$aliasResolveCommands[$command])) { + if (null !== $command && isset(self::$aliasResolveCommands[$command])) { // When the command name is abbreviated (e.g. "req" for "require"), Composer // activates plugins early to look up potential script commands, before the // input has been bound to the command definition. In that case "packages"