X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiBase.php;h=056d10c3c98ad3996e8a2efed4969b2ef9254c9d;hb=28d9e60182f33c507147f48b15566c653b890a3c;hp=d10b915076819f5cec6b19740a95ed7e2f7326cb;hpb=0c0676c34eeced65847f20b896049070a766a532;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index d10b915076..056d10c3c9 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1308,8 +1308,15 @@ abstract class ApiBase extends ContextSource { } break; case 'limit': + // Must be a number or 'max' + if ( $value !== 'max' ) { + $value = (int)$value; + } + if ( $multi ) { + self::dieDebug( __METHOD__, "Multi-values not supported for $encParamName" ); + } if ( !$parseLimit ) { - // Don't do any validation whatsoever + // Don't do min/max validation and don't parse 'max' break; } if ( !isset( $paramSettings[self::PARAM_MAX] ) @@ -1320,21 +1327,16 @@ abstract class ApiBase extends ContextSource { "MAX1 or MAX2 are not defined for the limit $encParamName" ); } - if ( $multi ) { - self::dieDebug( __METHOD__, "Multi-values not supported for $encParamName" ); - } - $min = $paramSettings[self::PARAM_MIN] ?? 0; - if ( $value == 'max' ) { + if ( $value === 'max' ) { $value = $this->getMain()->canApiHighLimits() ? $paramSettings[self::PARAM_MAX2] : $paramSettings[self::PARAM_MAX]; $this->getResult()->addParsedLimit( $this->getModuleName(), $value ); } else { - $value = (int)$value; $this->validateLimit( $paramName, $value, - $min, + $paramSettings[self::PARAM_MIN] ?? 0, $paramSettings[self::PARAM_MAX], $paramSettings[self::PARAM_MAX2] );