* (bug 27376) when using ApiBase::PARAM_TYPE => 'integer' without a min or max value...
authorSam Reed <reedy@users.mediawiki.org>
Sun, 13 Feb 2011 17:00:47 +0000 (17:00 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sun, 13 Feb 2011 17:00:47 +0000 (17:00 +0000)
Fixup some space indention

RELEASE-NOTES
includes/api/ApiBase.php

index 600dd6a..1e5d474 100644 (file)
@@ -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 ===
 
index 7775c7d..babaf78 100644 (file)
@@ -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':