// Set a dummy $wgTitle, because $wgTitle == null breaks various things
// In a perfect world this wouldn't be necessary
-$wgTitle = Title::newFromText( 'API' );
+$wgTitle = Title::makeTitle( NS_MAIN, 'API' );
/* Construct an ApiMain with the arguments passed via the URL. What we get back
* is some form of an ApiMain, possibly even one that produces an error message,
protected function parseMultiValue( $valueName, $value, $allowMultiple, $allowedValues ) {
if ( trim( $value ) === "" && $allowMultiple )
return array();
- $sizeLimit = $this->mMainModule->canApiHighLimits() ? self::LIMIT_SML2 : self::LIMIT_SML1;
- $valuesList = explode( '|', $value, $sizeLimit + 1 );
+
+ // This is a bit awkward, but we want to avoid calling canApiHighLimits() because it unstubs $wgUser
+ $valuesList = explode( '|', $value, self::LIMIT_SML2 + 1 );
+ $sizeLimit = count( $valuesList ) > self::LIMIT_SML1 && $this->mMainModule->canApiHighLimits() ?
+ self::LIMIT_SML2 : self::LIMIT_SML1;
if ( self::truncateArray( $valuesList, $sizeLimit ) ) {
$this->setWarning( "Too many values supplied for parameter '$valueName': the limit is $sizeLimit" );