First part of "*(bug 25303) API: integer parameter validation does not actually valid...
authorSam Reed <reedy@users.mediawiki.org>
Sun, 3 Oct 2010 19:07:11 +0000 (19:07 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sun, 3 Oct 2010 19:07:11 +0000 (19:07 +0000)
Actually make the validation of the range occur

Fix typo in ApiBase.php

includes/api/ApiBase.php
includes/api/ApiResult.php

index c025c4d..d45eefa 100644 (file)
@@ -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 );
                                                        }
                                                }
index 20c0b8b..ee1923f 100644 (file)
@@ -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