It seems to happen when opensearch or prefixsearch api is called with an
invalid namespace parameter.
Change-Id: I1dda12c93db03c520080e8ee57bd750396905a58
*/
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