X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fsearch%2FSearchNearMatcher.php;h=0a644934c47c05eee2c9f4ef3318cf8d2e8f5c3f;hb=b7625d63a6f1f8867c911dbd6e93eebdaca3312f;hp=27046f31561f610b169b7d86ecdd1ec3d92d8dac;hpb=53ecf20db8bfc2109553e80bf932dac7321d63ec;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/search/SearchNearMatcher.php b/includes/search/SearchNearMatcher.php index 27046f3156..0a644934c4 100644 --- a/includes/search/SearchNearMatcher.php +++ b/includes/search/SearchNearMatcher.php @@ -53,7 +53,6 @@ class SearchNearMatcher { */ protected function getNearMatchInternal( $searchterm ) { $lang = $this->language; - $allSearchTerms = [ $searchterm ]; if ( $lang->hasVariants() ) { @@ -68,6 +67,13 @@ class SearchNearMatcher { return $titleResult; } + // Most of our handling here deals with finding a valid title for the search term, + // but almost anything starting with '#' is "valid" and points to Main_Page#searchterm. + // Rather than doing something completely wrong, do nothing. + if ( $searchterm === '' || $searchterm[0] === '#' ) { + return null; + } + foreach ( $allSearchTerms as $term ) { # Exact match? No need to look further. $title = Title::newFromText( $term );