From f5e6c7580487ed853f67c0bee556a79a52ceb1ac Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 10 Dec 2015 14:53:34 +0100 Subject: [PATCH] Make AppManager->checkAppForUser more robust * if the JSON that is stored in the DB is corrupt an error was thrown * with this change it is properly handled and the app is disabled --- lib/private/app/appmanager.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/private/app/appmanager.php b/lib/private/app/appmanager.php index f826c8ba0c7..8ae93f98832 100644 --- a/lib/private/app/appmanager.php +++ b/lib/private/app/appmanager.php @@ -148,6 +148,13 @@ class AppManager implements IAppManager { return false; } else { $groupIds = json_decode($enabled); + + if (!is_array($groupIds)) { + $jsonError = json_last_error(); + \OC::$server->getLogger()->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError, ['app' => 'lib']); + return false; + } + $userGroups = $this->groupManager->getUserGroupIds($user); foreach ($userGroups as $groupId) { if (array_search($groupId, $groupIds) !== false) { -- 2.39.5