Anomie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/235460
Change subject: ApiLogin: Don't try to add block info if there's no block
......................................................................
ApiLogin: Don't try to add block info if there's no block
Extensions such as CentralAuth can use various hooks to return
USER_BLOCKED or CREATE_BLOCKED despite there being no local block.
Bug: T111082
Change-Id: I3433a35547967852fc30bd56274392a186004a38
---
M includes/api/ApiLogin.php
1 file changed, 8 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/60/235460/1
diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php
index 8c65310..c66e215 100644
--- a/includes/api/ApiLogin.php
+++ b/includes/api/ApiLogin.php
@@ -145,10 +145,10 @@
case LoginForm::CREATE_BLOCKED:
$result['result'] = 'CreateBlocked';
$result['details'] = 'Your IP address is
blocked from account creation';
- $result = array_merge(
- $result,
- ApiQueryUserInfo::getBlockInfo(
$context->getUser()->getBlock() )
- );
+ $block = $context->getUser()->getBlock();
+ if ( $block ) {
+ $result = array_merge( $result,
ApiQueryUserInfo::getBlockInfo( $block ) );
+ }
break;
case LoginForm::THROTTLED:
@@ -159,10 +159,10 @@
case LoginForm::USER_BLOCKED:
$result['result'] = 'Blocked';
- $result = array_merge(
- $result,
- ApiQueryUserInfo::getBlockInfo(
User::newFromName( $params['name'] )->getBlock() )
- );
+ $block = User::newFromName( $params['name']
)->getBlock();
+ if ( $block ) {
+ $result = array_merge( $result,
ApiQueryUserInfo::getBlockInfo( $block ) );
+ }
break;
case LoginForm::ABORTED:
--
To view, visit https://gerrit.wikimedia.org/r/235460
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3433a35547967852fc30bd56274392a186004a38
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits