X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiBlock.php;h=366a6df98f46d3255c3323bc55b5442da0b2b601;hb=d9ba5906d0da6ea24705ba53ce6584c1ca8716bb;hp=4d37af31627891d293801787ba21dad2515a9d3f;hpb=6fbafe5494440f5c37686b250ed759f6a96271b9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index 4d37af3162..366a6df98f 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -67,12 +67,12 @@ class ApiBlock extends ApiBase { $params['user'] = $username; } } else { - $target = User::newFromName( $params['user'] ); + list( $target, $type ) = SpecialBlock::getTargetAndType( $params['user'] ); // T40633 - if the target is a user (not an IP address), but it // doesn't exist or is unusable, error. - if ( $target instanceof User && - ( $target->isAnon() /* doesn't exist */ || !User::isUsableName( $target->getName() ) ) + if ( $type === Block::TYPE_USER && + ( $target->isAnon() /* doesn't exist */ || !User::isUsableName( $params['user'] ) ) ) { $this->dieWithError( [ 'nosuchusershort', $params['user'] ], 'nosuchuser' ); }