Gergő Tisza has uploaded a new change for review.
https://gerrit.wikimedia.org/r/247026
Change subject: Handle empty return from MWOAuthDataStore::lookup_consumer
......................................................................
Handle empty return from MWOAuthDataStore::lookup_consumer
This should never be needed as we don't delete from the oarc table
or change consumer keys, but just in case someone deleted a record
manually, fail gracefully on empty return.
Bug: T103023
Change-Id: I3a90f20816124c4ba50bd8895276004c71471617
---
M backend/MWOAuthDataStore.php
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAuth
refs/changes/26/247026/1
diff --git a/backend/MWOAuthDataStore.php b/backend/MWOAuthDataStore.php
index c50fd2f..c9498dc 100644
--- a/backend/MWOAuthDataStore.php
+++ b/backend/MWOAuthDataStore.php
@@ -21,7 +21,7 @@
* Get an MWOAuthConsumer from the consumer's key
*
* @param String $consumerKey the string value of the Consumer's key
- * @return MWOAuthConsumer
+ * @return MWOAuthConsumer|bool
*/
public function lookup_consumer( $consumerKey ) {
return MWOAuthConsumer::newFromKey( $this->centralDB,
$consumerKey );
@@ -59,7 +59,7 @@
}
// Ensure the cmra's consumer matches the expected
consumer (T103023)
$mwconsumer = $this->lookup_consumer( $consumer->key );
- if ( $mwconsumer->get( 'id') !== $cmra->get(
'consumerId') ) {
+ if ( !$mwconsumer || $mwconsumer->get( 'id') !==
$cmra->get( 'consumerId') ) {
throw new MWOAuthException(
'mwoauthdatastore-access-token-not-found' );
}
$secret = MWOAuthUtils::hmacDBSecret( $cmra->get(
'accessSecret' ) );
--
To view, visit https://gerrit.wikimedia.org/r/247026
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3a90f20816124c4ba50bd8895276004c71471617
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits