From: Tim Starling Date: Fri, 14 Nov 2008 00:30:34 +0000 (+0000) Subject: Don't use getParameter() inside substituteResultWithError(), since it will try to... X-Git-Tag: 1.31.0-rc.0~44351 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=4daa2dbb6a5711886e54148ab019ff15f92231c7;p=lhc%2Fweb%2Fwiklou.git Don't use getParameter() inside substituteResultWithError(), since it will try to call dieUsage() again if the format parameter is invalid. This fixes the error message for invalid formats, which was broken. --- diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index 834588a1ca..0c832aa368 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -69,6 +69,13 @@ abstract class ApiFormatBase extends ApiBase { return false; } + /** + * Get the internal format name + */ + public function getFormat() { + return $this->mFormat; + } + /** * Specify whether or not ampersands should be escaped to '&' when rendering. This * should only be set to true for the help message when rendered in the default (xmlfm) diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 35c14262c4..e94f173162 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -445,7 +445,7 @@ class ApiMain extends ApiBase { * tell the printer not to escape ampersands so that our links do * not break. */ $printer->setUnescapeAmps ( ( $this->mAction == 'help' || $isError ) - && $this->getParameter('format') == ApiMain::API_DEFAULT_FORMAT ); + && $printer->getFormat() == 'XML' && $printer->getIsHtml() ); $printer->initPrinter($isError);