From ea2935430a400dfadf98a51693d0cdefc6b96f21 Mon Sep 17 00:00:00 2001 From: Paulo Pinto Date: Thu, 14 Sep 2023 15:47:30 +0100 Subject: [PATCH] If more than one user is found, something is wrong --- src/Storage/AuthorizationCodeStorage.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Storage/AuthorizationCodeStorage.php b/src/Storage/AuthorizationCodeStorage.php index d8365e5..b26c863 100644 --- a/src/Storage/AuthorizationCodeStorage.php +++ b/src/Storage/AuthorizationCodeStorage.php @@ -42,6 +42,12 @@ private function getUserIdByCode( $code ) { return null; } + if ( count( $users ) > 1 ) { + // This should never happen. + // If it does, something is wrong, so it's best to not return any user. + return null; + } + return absint( $users[0]->ID ); }