From: Kevin Israel Date: Sat, 23 Feb 2013 21:19:29 +0000 (-0500) Subject: XML format: fix "Unrecognized parameter" warning X-Git-Tag: 1.31.0-rc.0~20588^2 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=5be9e2843990ad3b946a7938e01319b54c0d6265;p=lhc%2Fweb%2Fwiklou.git XML format: fix "Unrecognized parameter" warning ApiMain::reportUnusedParams() is called before the XML formatter is executed, so using "includexmlnamespace" or another such parameter causes the incorrect generation of a warning. This patch corrects the issue by explicitly excluding valid formatter parameters from the list of unused parameters. This does not need a release note because MediaWiki 1.20 did not generate this kind of warning. Change-Id: I269a6e07aa245099c811947d7832e1aa6fcfb9ec --- diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index fed515b7dd..c3ae8b1150 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -921,7 +921,13 @@ class ApiMain extends ApiBase { $paramsUsed = $this->getParamsUsed(); $allParams = $this->getRequest()->getValueNames(); - $unusedParams = array_diff( $allParams, $paramsUsed ); + // Printer has not yet executed; don't warn that its parameters are unused + $printerParams = array_map( + array( $this->mPrinter, 'encodeParamName' ), + array_keys( $this->mPrinter->getFinalParams() ?: array() ) + ); + + $unusedParams = array_diff( $allParams, $paramsUsed, $printerParams ); if( count( $unusedParams ) ) { $s = count( $unusedParams ) > 1 ? 's' : ''; $this->setWarning( "Unrecognized parameter$s: '" . implode( $unusedParams, "', '" ) . "'" );