From 8f93ebbde09cdbb57120c657c85f9182eb12cc96 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Wed, 6 Jul 2011 20:18:22 +0000 Subject: [PATCH] * (bug 29745) Fatal error in API search Properly name objects being used --- RELEASE-NOTES-1.19 | 3 ++- includes/api/ApiQuerySearch.php | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 4b09da318a..c135eb70bd 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -131,7 +131,7 @@ production. correctly. * (bug 29567) mw.util.addPortletLink should only wrap link in for "vectorTabs" portlets. -* (bug 8556) Incorrect session failure warning on preview-on-open +* (bug 8556) Incorrect session failure warning on preview-on-open namespaces (categories) when combined with $wgRawHtml. * Use content language in formatting of dates in revertpage message (rollback revert edit summary) and do not adjust for user timezone. @@ -165,6 +165,7 @@ production. * (bug 27595) sha1 search of list=filearchive does not work * (bug 26763) Make RSS/Atom of user contributions more visible * (bug 25133) Allow redirects also for action=parse&pageid +* (bug 29745) Fatal error in API search === Languages updated in 1.19 === diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index e5bf0d06d5..bd7adc2e96 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -97,17 +97,17 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { $this->dieUsage( "{$what} search is disabled", "search-{$what}-disabled" ); } - $result = $this->getResult(); + $apiResult = $this->getResult(); // Add search meta data to result if ( isset( $searchInfo['totalhits'] ) ) { $totalhits = $matches->getTotalHits(); if ( $totalhits !== null ) { - $result->addValue( array( 'query', 'searchinfo' ), + $apiResult->addValue( array( 'query', 'searchinfo' ), 'totalhits', $totalhits ); } } if ( isset( $searchInfo['suggestion'] ) && $matches->hasSuggestion() ) { - $result->addValue( array( 'query', 'searchinfo' ), + $apiResult->addValue( array( 'query', 'searchinfo' ), 'suggestion', $matches->getSuggestionQuery() ); } @@ -116,6 +116,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { $titles = array(); $count = 0; $result = $matches->next(); + while ( $result ) { if ( ++ $count > $limit ) { // We've reached the one extra which shows that there are additional items to be had. Stop here... @@ -172,7 +173,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { } // Add item to results and see whether it fits - $fit = $result->addValue( array( 'query', $this->getModuleName() ), + $fit = $apiResult->addValue( array( 'query', $this->getModuleName() ), null, $vals ); if ( !$fit ) { $this->setContinueEnumParameter( 'offset', $params['offset'] + $count - 1 ); @@ -186,7 +187,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { } if ( is_null( $resultPageSet ) ) { - $result->setIndexedTagName_internal( array( + $apiResult->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'p' ); } else { -- 2.20.1