DCausse has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/280667

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/67/280667/1

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: newchange
Gerrit-Change-Id: I1dda12c93db03c520080e8ee57bd750396905a58
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: DCausse <[email protected]>

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

Reply via email to