diff options
author | Brad Jorsch <bjorsch@wikimedia.org> | 2015-04-29 10:39:25 -0400 |
---|---|---|
committer | Brad Jorsch <bjorsch@wikimedia.org> | 2015-04-29 10:43:45 -0400 |
commit | ce6e288ee85f7989172e5a670df68fd2fd3c151e (patch) | |
tree | 98ceb009c6960bcb20063a0eae7de365f2c78d55 /includes/api/ApiResult.php | |
parent | e5bd1987709b0cc0590041f5a9f6dd31e6cc3530 (diff) | |
download | mediawikicore-ce6e288ee85f7989172e5a670df68fd2fd3c151e.tar.gz mediawikicore-ce6e288ee85f7989172e5a670df68fd2fd3c151e.zip |
API: ApiResult must validate even when using numeric auto-indexes
Bug: T97490
Change-Id: I5301a615a992b090000a59f86e13b9f78dcd5aec
Diffstat (limited to 'includes/api/ApiResult.php')
-rw-r--r-- | includes/api/ApiResult.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/includes/api/ApiResult.php b/includes/api/ApiResult.php index 345cf43a2f16..044b6e067c6b 100644 --- a/includes/api/ApiResult.php +++ b/includes/api/ApiResult.php @@ -276,6 +276,10 @@ class ApiResult implements ApiSerializable { * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. */ public static function setValue( array &$arr, $name, $value, $flags = 0 ) { + if ( !( $flags & ApiResult::NO_VALIDATE ) ) { + $value = self::validateValue( $value ); + } + if ( $name === null ) { if ( $flags & ApiResult::ADD_ON_TOP ) { array_unshift( $arr, $value ); @@ -285,10 +289,6 @@ class ApiResult implements ApiSerializable { return; } - if ( !( $flags & ApiResult::NO_VALIDATE ) ) { - $value = self::validateValue( $value ); - } - $exists = isset( $arr[$name] ); if ( !$exists || ( $flags & ApiResult::OVERRIDE ) ) { if ( !$exists && ( $flags & ApiResult::ADD_ON_TOP ) ) { |