diff --git a/src/League/OAuth2/Server/Entity/Session.php b/src/League/OAuth2/Server/Entity/Session.php index c79a88b0..d42c482b 100644 --- a/src/League/OAuth2/Server/Entity/Session.php +++ b/src/League/OAuth2/Server/Entity/Session.php @@ -156,9 +156,11 @@ class Session private function formatScopes($unformated = []) { $scopes = []; - foreach ($unformated as $scope) { - if ($scope instanceof Scope) { - $scopes[$scope->getId()] = $scope; + if (is_array($unformated)) { + foreach ($unformated as $scope) { + if ($scope instanceof Scope) { + $scopes[$scope->getId()] = $scope; + } } } return $scopes;