From 3721e827ac6102a2d9e801de17bc89355692be52 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 13 Feb 2011 17:00:47 +0000 Subject: [PATCH] * (bug 27376) when using ApiBase::PARAM_TYPE => 'integer' without a min or max value, api doesn't validate the input is actually an integer Fixup some space indention --- RELEASE-NOTES | 2 ++ includes/api/ApiBase.php | 16 +++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 600dd6aaf1..1e5d4746fa 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -169,6 +169,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Add a amtitle param to meta=allmessages * (bug 25832) query=allimages now outputs ns/title as well * (bug 27199) Thumbnail urls can be fetched for old files as well +* (bug 27376) when using ApiBase::PARAM_TYPE => 'integer' without a min or + max value, api doesn't validate the input is actually an integer === Languages updated in 1.18 === diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 7775c7d068..babaf7844c 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -707,15 +707,17 @@ abstract class ApiBase { ? $paramSettings[self::PARAM_RANGE_ENFORCE] : false; if ( !is_null( $min ) || !is_null( $max ) ) { - if ( is_array( $value ) ) { - $value = array_map( 'intval', $value ); - foreach ( $value as &$v ) { + if ( is_array( $value ) ) { + $value = array_map( 'intval', $value ); + foreach ( $value as &$v ) { $this->validateLimit( $paramName, $v, $min, $max, null, $enforceLimits ); } - } else { - $value = intval( $value ); - $this->validateLimit( $paramName, $value, $min, $max, null, $enforceLimits ); - } + } else { + $value = intval( $value ); + $this->validateLimit( $paramName, $value, $min, $max, null, $enforceLimits ); + } + } else { + $value = intval( $value ); } break; case 'limit': -- 2.20.1