From 1a365e77dfb8825136626202b1df462731b42060 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 16 Aug 2015 08:22:05 +0200 Subject: Update to MediaWiki 1.25.2 --- includes/api/ApiBase.php | 2 +- includes/api/ApiOpenSearch.php | 14 +++++++++++++- includes/api/ApiQueryImageInfo.php | 5 ++++- 3 files changed, 18 insertions(+), 3 deletions(-) (limited to 'includes/api') diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 5a1eb995..6c33da57 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1192,7 +1192,7 @@ abstract class ApiBase extends ContextSource { $this->dieUsage( 'Specified user does not exist', 'bad_wlowner' ); } $token = $user->getOption( 'watchlisttoken' ); - if ( $token == '' || $token != $params['token'] ) { + if ( $token == '' || !hash_equals( $token, $params['token'] ) ) { $this->dieUsage( 'Incorrect watchlist token provided -- please set a correct token in Special:Preferences', 'bad_wltoken' diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php index a93b7cc6..0adb464d 100644 --- a/includes/api/ApiOpenSearch.php +++ b/includes/api/ApiOpenSearch.php @@ -384,13 +384,25 @@ class ApiOpenSearchFormatJson extends ApiFormatJson { public function execute() { if ( !$this->getResult()->getResultData( 'error' ) ) { - $warnings = $this->getResult()->removeValue( 'warnings', null ); + $result = $this->getResult(); + + // Ignore warnings or treat as errors, as requested + $warnings = $result->removeValue( 'warnings', null ); if ( $this->warningsAsError && $warnings ) { $this->dieUsage( 'Warnings cannot be represented in OpenSearch JSON format', 'warnings', 0, array( 'warnings' => $warnings ) ); } + + // Ignore any other unexpected keys (e.g. from $wgDebugToolbar) + $remove = array_keys( array_diff_key( + $result->getResultData(), + array( 0 => 'search', 1 => 'terms', 2 => 'descriptions', 3 => 'urls' ) + ) ); + foreach ( $remove as $key ) { + $result->removeValue( $key, null ); + } } parent::execute(); diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index 94b4bbdb..095e5dda 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -592,7 +592,10 @@ class ApiQueryImageInfo extends ApiQueryBase { $retval = array(); if ( is_array( $metadata ) ) { foreach ( $metadata as $key => $value ) { - $r = array( 'name' => $key ); + $r = array( + 'name' => $key, + ApiResult::META_BC_BOOLS => array( 'value' ), + ); if ( is_array( $value ) ) { $r['value'] = self::processMetaData( $value, $result ); } else { -- cgit v1.2.2