From 382a836d807156af8786867f1e76a9e0f936f2b0 Mon Sep 17 00:00:00 2001 From: Ricardo Verdugo Date: Tue, 24 Oct 2023 10:28:23 +0100 Subject: [PATCH] Fix invalid input to foreach (#3724) * Fix invalid input to foreach This happens with discord oauth, possibly others * Update UserGroupObject.php --------- Co-authored-by: Andy Miller <1084697+rhukster@users.noreply.github.com> --- .../src/Grav/Common/Flex/Types/UserGroups/UserGroupObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupObject.php b/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupObject.php index b3d7b237f..8ecee2f1a 100644 --- a/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupObject.php +++ b/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupObject.php @@ -78,7 +78,7 @@ public function authorize(string $action, string $scope = null): ?bool public static function groupNames(): array { $groups = []; - $user_groups = Grav::instance()['user_groups']; + $user_groups = Grav::instance()['user_groups'] ?? []; foreach ($user_groups as $key => $group) { $groups[$key] = $group->readableName;