commentparser: Allow signature of user '0' to be detected

Bug: T379918
Change-Id: I11a447c11fe64dae88a5035b007fe762a335e6c5
(cherry picked from commit 84d0dfc51c)
This commit is contained in:
Ammarpad 2024-11-14 15:03:50 +01:00 committed by Reedy
parent bf893d54d9
commit 6bbab06fc5

View file

@ -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'];
}