From c51b80a3666a1f4dd9276cca7bc0a9453e75c210 Mon Sep 17 00:00:00 2001 From: Mohit Mamoria Date: Fri, 30 May 2014 17:09:51 +0530 Subject: [PATCH 1/2] Converting PDO results into objects to cater for settings to fetch result as array --- src/LucaDegasperi/OAuth2Server/Repositories/FluentClient.php | 2 ++ src/LucaDegasperi/OAuth2Server/Repositories/FluentScope.php | 2 ++ src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/LucaDegasperi/OAuth2Server/Repositories/FluentClient.php b/src/LucaDegasperi/OAuth2Server/Repositories/FluentClient.php index a4958194..a212a065 100644 --- a/src/LucaDegasperi/OAuth2Server/Repositories/FluentClient.php +++ b/src/LucaDegasperi/OAuth2Server/Repositories/FluentClient.php @@ -94,6 +94,8 @@ public function getClient($clientId, $clientSecret = null, $redirectUri = null, return false; } + $result = (object) $result; + $metadata = DB::table('oauth_client_metadata')->where('client_id', '=', $result->id)->lists('value', 'key'); return array( diff --git a/src/LucaDegasperi/OAuth2Server/Repositories/FluentScope.php b/src/LucaDegasperi/OAuth2Server/Repositories/FluentScope.php index 68a5700e..7d604ea6 100644 --- a/src/LucaDegasperi/OAuth2Server/Repositories/FluentScope.php +++ b/src/LucaDegasperi/OAuth2Server/Repositories/FluentScope.php @@ -57,6 +57,8 @@ public function getScope($scope, $clientId = null, $grantType = null) return false; } + $result = (object) $result; + return array( 'id' => $result->id, 'scope' => $result->scope, diff --git a/src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php b/src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php index 6a44cd2d..d1bfc734 100644 --- a/src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php +++ b/src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php @@ -385,6 +385,7 @@ public function getScopes($accessToken) foreach($scopeResults as $key=>$scope) { + $scope = (object) $scope; $scopes[$key] = get_object_vars($scope); } @@ -497,6 +498,7 @@ public function deleteExpired() return 0; } else { foreach ($expiredSessions as $session) { + $session = (object) $session; DB::table('oauth_sessions') ->where('id', '=', $session->session_id) ->delete(); From a90ac346877163cead9a5284f58b5e999bd026fb Mon Sep 17 00:00:00 2001 From: Mohit Mamoria Date: Fri, 30 May 2014 17:40:03 +0530 Subject: [PATCH 2/2] Fixed typecasting to object at another place --- src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php b/src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php index d1bfc734..4fd80caa 100644 --- a/src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php +++ b/src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php @@ -453,6 +453,7 @@ public function getAuthCodeScopes($oauthSessionAuthCodeId) foreach($scopesResults as $key=>$scope) { + $scope = (object) $scope; $scopes[$key] = get_object_vars($scope); }