From: Brad Jorsch Date: Wed, 24 Aug 2016 16:10:05 +0000 (-0400) Subject: API: Log when too many values are passed for a multi-valued parameter X-Git-Tag: 1.31.0-rc.0~5903^2 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=fbf947941d5db06c55ad75d45983284dc3276273;p=lhc%2Fweb%2Fwiklou.git API: Log when too many values are passed for a multi-valued parameter Currently the API just throws away the excess values, no continuation. This is probably not the best behavior. There is a warning, but clients are notorious for just ignoring warnings. We could improve the situation: * Turn it into an error. * Turn it into an error for most cases, but allow some to override if necessary. * Allow some cases to make it an error, while keeping it a warning by default. Before we can decide which option to pick, we should get an idea of how often this is being hit and which things it's being hit for. Bug: T41936 Change-Id: I52926f410c30d1cd7e7fcd86465b16519fb5cbd2 --- diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index fcb748c202..66c1b530de 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1171,6 +1171,7 @@ abstract class ApiBase extends ContextSource { : self::LIMIT_SML1; if ( self::truncateArray( $valuesList, $sizeLimit ) ) { + $this->logFeatureUsage( "too-many-$valueName-for-{$this->getModulePath()}" ); $this->setWarning( "Too many values supplied for parameter '$valueName': " . "the limit is $sizeLimit" ); }