From 00286eefa819110ec88c05a5e115690f4f7a7cba Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 11 Sep 2024 11:26:59 +0200 Subject: [PATCH] fix: `user:settings` command when user is not available If `ignore-missing-user` all sub commands work, except listing all settings for a user like `occ user:settings --ignore-missing-user user core`. Signed-off-by: Ferdinand Thiessen --- core/Command/User/Setting.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/Command/User/Setting.php b/core/Command/User/Setting.php index e2e65f7d5f98d..16e851d82523f 100644 --- a/core/Command/User/Setting.php +++ b/core/Command/User/Setting.php @@ -219,7 +219,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } } - protected function getUserSettings($uid, $app) { + protected function getUserSettings(string $uid, string $app): array { $settings = $this->config->getAllUserValues($uid); if ($app !== '') { if (isset($settings[$app])) { @@ -230,7 +230,10 @@ protected function getUserSettings($uid, $app) { } $user = $this->userManager->get($uid); - $settings['settings']['display_name'] = $user->getDisplayName(); + if ($user !== null) { + // Only add the display name if the user exists + $settings['settings']['display_name'] = $user->getDisplayName(); + } return $settings; }