r74230 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74229‎ | r74230 | r74231 >
Date:19:07, 3 October 2010
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
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
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiResult.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiResult.php
@@ -246,7 +246,7 @@
247247
248248 /**
249249 * Add value to the output data at the given path.
250 - * Path is an indexed array, each element specifing the branch at which to add the new value
 250+ * Path is an indexed array, each element specifying the branch at which to add the new value
251251 * Setting $path to array('a','b','c') is equivalent to data['a']['b']['c'] = $value
252252 * If $name is empty, the $value is added as a next list element data[] = $value
253253 * @return bool True if $value fits in the result, false if not
Index: trunk/phase3/includes/api/ApiBase.php
@@ -682,8 +682,8 @@
683683 $max = isset ( $paramSettings[self::PARAM_MAX] ) ? $paramSettings[self::PARAM_MAX] : null;
684684
685685 if ( !is_null( $min ) || !is_null( $max ) ) {
686 - $values = is_array( $value ) ? $value : array( $value );
687 - foreach ( $values as &$v ) {
 686+ $value = is_array( $value ) ? $value : array( $value );
 687+ foreach ( $value as &$v ) {
688688 $this->validateLimit( $paramName, $v, $min, $max );
689689 }
690690 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r74232Followup r74230, if we make things array, we should make them not an array af...reedy20:07, 3 October 2010
r74235RELEASE-NOTES for * (bug 25303) API: integer parameter validation does not ac...reedy20:31, 3 October 2010

Comments

#Comment by Brion VIBBER (talk | contribs)   20:56, 3 October 2010

r74232 fixes the bug in this rev that changes $value into an array if it was scalar.

Status & tagging log