Merge "Fix Undefined index: 0 in SearchExactMatchRescorer.php on line 44"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 2 Apr 2016 17:21:13 +0000 (17:21 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 2 Apr 2016 17:21:13 +0000 (17:21 +0000)
includes/search/SearchExactMatchRescorer.php

index d3b9d5c..40cfe39 100644 (file)
@@ -41,7 +41,7 @@ class SearchExactMatchRescorer {
         */
        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