From f1710b57bc62a2ce99e5b0534ad6b9e4497cd25c Mon Sep 17 00:00:00 2001 From: tgrant Date: Sun, 27 Sep 2020 12:50:08 +0100 Subject: [PATCH 1/2] Fix null displayname crash as described in #21885 Signed-off-by: tgrant --- lib/private/Group/Database.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php index 29fcb503b1..cc8ea2fb52 100644 --- a/lib/private/Group/Database.php +++ b/lib/private/Group/Database.php @@ -458,7 +458,11 @@ class Database extends ABackend implements public function getDisplayName(string $gid): string { if (isset($this->groupCache[$gid])) { - return $this->groupCache[$gid]['displayname']; + $displayName = $this->groupCache[$gid]['displayname']; + + if (isset($displayName) && trim($displayName) !== '') { + return $displayName; + } } $this->fixDI(); From 23dbbca1a0bc5a99224b8f5e5553042a53aa8767 Mon Sep 17 00:00:00 2001 From: Tom Grant Date: Sun, 27 Sep 2020 13:00:02 +0100 Subject: [PATCH 2/2] Fix indentation error Signed-off-by: tgrant --- lib/private/Group/Database.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php index cc8ea2fb52..fb557eafbb 100644 --- a/lib/private/Group/Database.php +++ b/lib/private/Group/Database.php @@ -458,11 +458,11 @@ class Database extends ABackend implements public function getDisplayName(string $gid): string { if (isset($this->groupCache[$gid])) { - $displayName = $this->groupCache[$gid]['displayname']; + $displayName = $this->groupCache[$gid]['displayname']; - if (isset($displayName) && trim($displayName) !== '') { - return $displayName; - } + if (isset($displayName) && trim($displayName) !== '') { + return $displayName; + } } $this->fixDI();