From adf100a42ffdbcc25eda717c8a80e0ba0458f437 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Mon, 7 Sep 2020 11:21:16 +0200 Subject: Fix undefined class property access after upgrade from 19 to 20 The serialized data in 19 has one property less and this was not considered in the code. Hence adding a fallback. Moreover I'm changing the deserialization into an array instead of object, as that is the safer option. Signed-off-by: Christoph Wurst --- lib/private/Authentication/LoginCredentials/Store.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/private/Authentication/LoginCredentials/Store.php b/lib/private/Authentication/LoginCredentials/Store.php index 6dd7dc3fb73..0a3b57b9c6c 100644 --- a/lib/private/Authentication/LoginCredentials/Store.php +++ b/lib/private/Authentication/LoginCredentials/Store.php @@ -111,8 +111,13 @@ class Store implements IStore { } if ($trySession && $this->session->exists('login_credentials')) { - $creds = json_decode($this->session->get('login_credentials')); - return new Credentials($creds->uid, $creds->loginName, $creds->password); + /** @var array $creds */ + $creds = json_decode($this->session->get('login_credentials'), true); + return new Credentials( + $creds['uid'], + $creds['loginName'] ?? $this->session->get('loginname') ?? $creds['uid'], // Pre 20 didn't have a loginName property, hence fall back to the session value and then to the UID + $creds['password'] + ); } // If we reach this line, an exception was thrown. -- cgit v1.2.3