Make sure OtherBlockLogLink's second parameter is a string
authorGlaisher <glaisher.wiki@gmail.com>
Fri, 29 Apr 2016 17:38:35 +0000 (22:38 +0500)
committerGlaisher <glaisher.wiki@gmail.com>
Fri, 29 Apr 2016 17:38:35 +0000 (22:38 +0500)
Bug: T132935
Change-Id: I0583d166d8bfc50e6d10a0ac46c18aeadefad068

includes/specials/SpecialBlock.php

index 625e4aa..fcadede 100644 (file)
@@ -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(