diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-09-07 11:21:16 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-09-07 13:31:24 +0200 |
commit | adf100a42ffdbcc25eda717c8a80e0ba0458f437 (patch) | |
tree | fb592835037c0d49d517ad16a022ea496580bcbd /lib | |
parent | 3eb748fc39e24c57f2ba57ed4fd089dd746bdd61 (diff) | |
download | nextcloud-server-adf100a42ffdbcc25eda717c8a80e0ba0458f437.tar.gz nextcloud-server-adf100a42ffdbcc25eda717c8a80e0ba0458f437.zip |
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 <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Authentication/LoginCredentials/Store.php | 9 |
1 files changed, 7 insertions, 2 deletions
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. |