From 5be9e2843990ad3b946a7938e01319b54c0d6265 Mon Sep 17 00:00:00 2001 From: Kevin Israel Date: Sat, 23 Feb 2013 16:19:29 -0500 Subject: [PATCH] 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 --- includes/api/ApiMain.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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, "', '" ) . "'" ); -- 2.20.1