Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -655,9 +655,12 @@ |
656 | 656 | protected function parseMultiValue( $valueName, $value, $allowMultiple, $allowedValues ) { |
657 | 657 | if ( trim( $value ) === "" && $allowMultiple ) |
658 | 658 | return array(); |
659 | | - $sizeLimit = $this->mMainModule->canApiHighLimits() ? self::LIMIT_SML2 : self::LIMIT_SML1; |
660 | | - $valuesList = explode( '|', $value, $sizeLimit + 1 ); |
661 | 659 | |
| 660 | + // This is a bit awkward, but we want to avoid calling canApiHighLimits() because it unstubs $wgUser |
| 661 | + $valuesList = explode( '|', $value, self::LIMIT_SML2 + 1 ); |
| 662 | + $sizeLimit = count( $valuesList ) > self::LIMIT_SML1 && $this->mMainModule->canApiHighLimits() ? |
| 663 | + self::LIMIT_SML2 : self::LIMIT_SML1; |
| 664 | + |
662 | 665 | if ( self::truncateArray( $valuesList, $sizeLimit ) ) { |
663 | 666 | $this->setWarning( "Too many values supplied for parameter '$valueName': the limit is $sizeLimit" ); |
664 | 667 | } |
Index: trunk/phase3/api.php |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | |
106 | 106 | // Set a dummy $wgTitle, because $wgTitle == null breaks various things |
107 | 107 | // In a perfect world this wouldn't be necessary |
108 | | -$wgTitle = Title::newFromText( 'API' ); |
| 108 | +$wgTitle = Title::makeTitle( NS_MAIN, 'API' ); |
109 | 109 | |
110 | 110 | /* Construct an ApiMain with the arguments passed via the URL. What we get back |
111 | 111 | * is some form of an ApiMain, possibly even one that produces an error message, |