]> source.dussan.org Git - nextcloud-server.git/commitdiff
Make AppManager->checkAppForUser more robust
authorMorris Jobke <hey@morrisjobke.de>
Thu, 10 Dec 2015 13:53:34 +0000 (14:53 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Thu, 10 Dec 2015 13:53:34 +0000 (14:53 +0100)
* 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

index f826c8ba0c7e16e27bfbe1ac4611023066b972aa..8ae93f98832c9a230d47b6218a85473a49635952 100644 (file)
@@ -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) {