From 731888235789bb04f4e889b46cbaa35094607b36 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 26 Apr 2018 20:47:47 +0200 Subject: [PATCH 1/2] json_decode an associative array for the swift cached token Signed-off-by: Roeland Jago Douma --- lib/private/Files/ObjectStore/SwiftFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Files/ObjectStore/SwiftFactory.php b/lib/private/Files/ObjectStore/SwiftFactory.php index 8baaec985e8..389a5df7195 100644 --- a/lib/private/Files/ObjectStore/SwiftFactory.php +++ b/lib/private/Files/ObjectStore/SwiftFactory.php @@ -56,7 +56,7 @@ class SwiftFactory { private function getCachedToken(string $cacheKey) { $cachedTokenString = $this->cache->get($cacheKey . '/token'); if ($cachedTokenString) { - return json_decode($cachedTokenString); + return json_decode($cachedTokenString, true); } else { return null; } From a0e038f91261a3ea75ca2c4c06a269c44bb9a575 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 26 Apr 2018 20:51:05 +0200 Subject: [PATCH 2/2] generateTokenFromCache is only valid for V3 Signed-off-by: Roeland Jago Douma --- lib/private/Files/ObjectStore/SwiftFactory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/ObjectStore/SwiftFactory.php b/lib/private/Files/ObjectStore/SwiftFactory.php index 389a5df7195..3ff534b4e64 100644 --- a/lib/private/Files/ObjectStore/SwiftFactory.php +++ b/lib/private/Files/ObjectStore/SwiftFactory.php @@ -131,9 +131,9 @@ class SwiftFactory { $cachedToken = $this->params['cachedToken']; $hasValidCachedToken = false; - if (is_array($cachedToken)) { + if (\is_array($cachedToken) && ($authService instanceof IdentityV3Service)) { $token = $authService->generateTokenFromCache($cachedToken); - if (is_null($token->catalog)) { + if (\is_null($token->catalog)) { $this->logger->warning('Invalid cached token for swift, no catalog set: ' . json_encode($cachedToken)); } else if ($token->hasExpired()) { $this->logger->debug('Cached token for swift expired');