From 84d0dfc51c15ee12befbf9f02d1dde9854710f05 Mon Sep 17 00:00:00 2001 From: Ammarpad Date: Thu, 14 Nov 2024 15:03:50 +0100 Subject: [PATCH] commentparser: Allow signature of user '0' to be detected Bug: T379918 Change-Id: I11a447c11fe64dae88a5035b007fe762a335e6c5 --- includes/CommentParser.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/CommentParser.php b/includes/CommentParser.php index b9761b477..7da5a9b7f 100644 --- a/includes/CommentParser.php +++ b/includes/CommentParser.php @@ -605,7 +605,7 @@ class CommentParser { $username = $userpage->getText(); } } - if ( !$username ) { + if ( $username === null ) { return null; } if ( IPUtils::isIPv6( $username ) ) { @@ -924,7 +924,7 @@ class CommentParser { $foundSignature = $this->findSignature( $node, $curCommentEnd ); $author = $foundSignature['username']; - if ( !$author ) { + if ( $author === null ) { // Ignore timestamps for which we couldn't find a signature. It's probably not a real // comment, but just a false match due to a copypasted timestamp. continue; @@ -969,7 +969,7 @@ class CommentParser { $treeWalker->currentNode = $n; // …and add it as another signature to this comment (regardless of the author and timestamp) $foundSignature2 = $this->findSignature( $n, $node ); - if ( $foundSignature2['username'] ) { + if ( $foundSignature2['username'] !== null ) { $sigRanges[] = $this->adjustSigRange( $foundSignature2['nodes'], $match2, $n ); $timestampRanges[] = $match2['range']; }