From 601d65b201739764da095a44d081ae952a796d02 Mon Sep 17 00:00:00 2001 From: Dereckson Date: Wed, 29 Jan 2014 16:31:03 +0100 Subject: [PATCH] OutputPage::showErrorPage raises a notice if arguments are incoherent The method has the following signature: OutputPage::showErrorPage( $title, $msg, $params = array() ) $msg can be a string or a Message object. If it's a string, a Message object is built, with $params as parameters. If it's a Message object, $params is ignored. The core now triggers a notice in the case a call is made with $msg an instance of Message object, and a (non-empty array) $params argument is given. Change-Id: I227a416f088fc1acd6a04345ed0e24d06f967ecc --- RELEASE-NOTES-1.23 | 1 + includes/OutputPage.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index 10caf6fc65..57080b75e9 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -201,6 +201,7 @@ changes to languages because of Bugzilla reports. * (bug 52813) Preference "Show table of contents (for pages with more than 3 headings)" was removed. * (bug 52810) Preference "Justify paragraphs" was removed. +* OutputPage::showErrorPage raises a notice if arguments are incoherent. ==== Removed classes ==== * FakeMemCachedClient (deprecated in 1.18) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 04792cfead..6d06693efb 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2147,6 +2147,9 @@ class OutputPage extends ContextSource { $this->prepareErrorPage( $title ); if ( $msg instanceof Message ) { + if ( $params !== array() ) { + trigger_error( 'Argument ignored: $params. The message parameters argument is discarded when the $msg argument is a Message object instead of a string.', E_USER_NOTICE ); + } $this->addHTML( $msg->parseAsBlock() ); } else { $this->addWikiMsgArray( $msg, $params ); -- 2.20.1