From 1177c70b9d153e0c50c703182a11447bd3e30f95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas.mueller@tmit.eu>
Date: Mon, 25 Jul 2016 09:46:19 +0200
Subject: [PATCH] [stable9.1] Fix undefined
 OfflineUser::composeAndStoreDisplayName() - fixes #23248

---
 apps/user_ldap/lib/User_LDAP.php | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php
index a2a65bb8406..3128f0de83c 100644
--- a/apps/user_ldap/lib/User_LDAP.php
+++ b/apps/user_ldap/lib/User_LDAP.php
@@ -384,8 +384,14 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
 			}
 
 			$user = $this->access->userManager->get($uid);
-			$displayName = $user->composeAndStoreDisplayName($displayName, $displayName2);
-			$this->access->connection->writeToCache($cacheKey, $displayName);
+			if ($user instanceof User) {
+				$displayName = $user->composeAndStoreDisplayName($displayName, $displayName2);
+				$this->access->connection->writeToCache($cacheKey, $displayName);
+			}
+			if ($user instanceof OfflineUser) {
+				/** @var OfflineUser $user*/
+				$displayName = $user->getDisplayName();
+			}
 			return $displayName;
 		}
 
-- 
GitLab