From 7ad52b7bdd0be996c9ba9b78c8b8b267a14d3690 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 3 Oct 2010 19:07:11 +0000 Subject: [PATCH] First part of "*(bug 25303) API: integer parameter validation does not actually validate, only warn" Actually make the validation of the range occur Fix typo in ApiBase.php --- includes/api/ApiBase.php | 4 ++-- includes/api/ApiResult.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index c025c4d682..d45eefaf73 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -682,8 +682,8 @@ abstract class ApiBase { $max = isset ( $paramSettings[self::PARAM_MAX] ) ? $paramSettings[self::PARAM_MAX] : null; if ( !is_null( $min ) || !is_null( $max ) ) { - $values = is_array( $value ) ? $value : array( $value ); - foreach ( $values as &$v ) { + $value = is_array( $value ) ? $value : array( $value ); + foreach ( $value as &$v ) { $this->validateLimit( $paramName, $v, $min, $max ); } } diff --git a/includes/api/ApiResult.php b/includes/api/ApiResult.php index 20c0b8b4bd..ee1923fd89 100644 --- a/includes/api/ApiResult.php +++ b/includes/api/ApiResult.php @@ -246,7 +246,7 @@ class ApiResult extends ApiBase { /** * Add value to the output data at the given path. - * Path is an indexed array, each element specifing the branch at which to add the new value + * Path is an indexed array, each element specifying the branch at which to add the new value * Setting $path to array('a','b','c') is equivalent to data['a']['b']['c'] = $value * If $name is empty, the $value is added as a next list element data[] = $value * @return bool True if $value fits in the result, false if not -- 2.20.1