Avoid "$text must be a string" in Linker::formatLinksInComment
Just check the passed variable on caller side to avoid the warning. Bug: T109977 Change-Id: I28fbf7408dee8f46675bd7514dc0a87b0924e153
This commit is contained in:
parent
36e17cb902
commit
9ce5ca9886
1 changed files with 12 additions and 10 deletions
|
|
@ -1464,17 +1464,19 @@ class Linker {
|
|||
$linkText = $text;
|
||||
$linkTarget = Linker::normalizeSubpageLink( $title, $match[1], $linkText );
|
||||
|
||||
$target = Title::newFromText( $linkTarget );
|
||||
if ( $target ) {
|
||||
if ( $target->getText() == '' && !$target->isExternal()
|
||||
&& !$local && $title
|
||||
) {
|
||||
$newTarget = clone $title;
|
||||
$newTarget->setFragment( '#' . $target->getFragment() );
|
||||
$target = $newTarget;
|
||||
}
|
||||
if ( $linkTarget !== null ) {
|
||||
$target = Title::newFromText( $linkTarget );
|
||||
if ( $target ) {
|
||||
if ( $target->getText() == '' && !$target->isExternal()
|
||||
&& !$local && $title
|
||||
) {
|
||||
$newTarget = clone $title;
|
||||
$newTarget->setFragment( '#' . $target->getFragment() );
|
||||
$target = $newTarget;
|
||||
}
|
||||
|
||||
$thelink = Linker::makeCommentLink( $target, $linkText . $inside, $wikiId ) . $trail;
|
||||
$thelink = Linker::makeCommentLink( $target, $linkText . $inside, $wikiId ) . $trail;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $thelink ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue