From a69c730dbb3ef1f1243053f825b7fef92ba421e2 Mon Sep 17 00:00:00 2001 From: Glaisher Date: Fri, 29 Apr 2016 22:38:35 +0500 Subject: [PATCH] Make sure OtherBlockLogLink's second parameter is a string Bug: T132935 Change-Id: I0583d166d8bfc50e6d10a0ac46c18aeadefad068 --- includes/specials/SpecialBlock.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index 625e4aa946..fcadedebc1 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -28,7 +28,7 @@ * @ingroup SpecialPage */ class SpecialBlock extends FormSpecialPage { - /** @var User User to be blocked, as passed either by parameter (url?wpTarget=Foo) + /** @var User|string|null User to be blocked, as passed either by parameter (url?wpTarget=Foo) * or as subpage (Special:Block/Foo) */ protected $target; @@ -330,8 +330,12 @@ class SpecialBlock extends FormSpecialPage { $otherBlockMessages = []; if ( $this->target !== null ) { + $targetName = $this->target; + if ( $this->target instanceof User ) { + $targetName = $this->target->getName(); + } # Get other blocks, i.e. from GlobalBlocking or TorBlock extension - Hooks::run( 'OtherBlockLogLink', [ &$otherBlockMessages, $this->target ] ); + Hooks::run( 'OtherBlockLogLink', [ &$otherBlockMessages, $targetName ] ); if ( count( $otherBlockMessages ) ) { $s = Html::rawElement( -- 2.20.1