From 9345ce5c25ee945a7b6ff1a038ad117c067b2d50 Mon Sep 17 00:00:00 2001 From: "Misha M.-Kupriyanov" Date: Fri, 31 Jul 2026 09:13:17 +0200 Subject: [PATCH] fix(console): write app command loading errors to stderr When an app fails to load its commands from info.xml, the error was written to stdout, while every other diagnostic in loadCommands() uses $output->getErrorOutput(). The command itself then runs normally and exits 0, so the message silently corrupts machine-readable output: $ ./occ app:list --output=json Connection refused {"enabled":{...},"disabled":{...}} $ echo $? 0 Anything piping `occ --output=json` into a JSON parser breaks, with no non-zero exit code to detect it by. Observed with notify_push on a setup that has the phpredis extension loaded but no Redis configured: RedisFactory::isAvailable() only checks whether the extension is loaded, so constructing the app's console commands ends up calling pconnect() and throws RedisException. --no-warnings is not a workaround for this, as it sets VERBOSITY_QUIET and suppresses the payload too. Route the message to the error output instead. It is still reported via logger->error() exactly as before. Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: Misha M.-Kupriyanov --- lib/private/Console/Application.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php index e18dcc5ff8ef0..103232ca49dbb 100644 --- a/lib/private/Console/Application.php +++ b/lib/private/Console/Application.php @@ -96,7 +96,7 @@ public function loadCommands( try { $this->loadCommandsFromInfoXml($info['commands']); } catch (\Throwable $e) { - $output->writeln('' . $e->getMessage() . ''); + $output->getErrorOutput()->writeln('' . $e->getMessage() . ''); $this->logger->error($e->getMessage(), [ 'exception' => $e, ]); @@ -118,7 +118,7 @@ public function loadCommands( try { $this->loadCommandsFromInfoXml($info['commands']); } catch (\Throwable $e) { - $output->writeln('' . $e->getMessage() . ''); + $output->getErrorOutput()->writeln('' . $e->getMessage() . ''); $this->logger->error($e->getMessage(), [ 'exception' => $e, ]);