Linker: Fix incorrect test added in Ib9816d8b
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 10 Jul 2019 17:30:03 +0000 (13:30 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Wed, 10 Jul 2019 17:30:03 +0000 (13:30 -0400)
The test was intended to check for whether we have a user ID *or* a user
name. Instead, it's checking if we have a user ID *and* a user name. And
it also failed to consider User:0.

Bug: T227656
Change-Id: Ia1b5c4a6ae028513b73a65cd2c885459327d29c3

includes/Linker.php

index f3d492f..2e0011c 100644 (file)
@@ -1121,7 +1121,7 @@ class Linker {
                ) {
                        $userId = $rev->getUser( Revision::FOR_THIS_USER );
                        $userText = $rev->getUserText( Revision::FOR_THIS_USER );
-                       if ( $userId && $userText ) {
+                       if ( $userId || (string)$userText !== '' ) {
                                $link = self::userLink( $userId, $userText )
                                        . self::userToolLinks( $userId, $userText, false, 0, null,
                                                $useParentheses );