jenkins-bot has submitted this change and it was merged.

Change subject: Fix Undefined index: 0 in SearchExactMatchRescorer.php on line 
44
......................................................................


Fix Undefined index: 0 in SearchExactMatchRescorer.php on line 44

It seems to happen when opensearch or prefixsearch api is called with an
invalid namespace parameter.

Change-Id: I1dda12c93db03c520080e8ee57bd750396905a58
---
M includes/search/SearchExactMatchRescorer.php
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  EBernhardson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/search/SearchExactMatchRescorer.php 
b/includes/search/SearchExactMatchRescorer.php
index d3b9d5c..40cfe39 100644
--- a/includes/search/SearchExactMatchRescorer.php
+++ b/includes/search/SearchExactMatchRescorer.php
@@ -41,7 +41,7 @@
         */
        public function rescore( $search, $namespaces, $srchres, $limit ) {
                // Pick namespace (based on PrefixSearch::defaultSearchBackend)
-               $ns = in_array( NS_MAIN, $namespaces ) ? NS_MAIN : 
$namespaces[0];
+               $ns = in_array( NS_MAIN, $namespaces ) ? NS_MAIN : reset( 
$namespaces );
                $t = Title::newFromText( $search, $ns );
                if ( !$t || !$t->exists() ) {
                        // No exact match so just return the search results

-- 
To view, visit https://gerrit.wikimedia.org/r/280667
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1dda12c93db03c520080e8ee57bd750396905a58
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: DCausse <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to