From 18faa76dcb73b1873225fa5f9c2b850df7be127a Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Tue, 12 Jun 2018 10:44:44 -0700 Subject: [PATCH] EditPage::getContextTitle(): Deprecate falling back to $wgTitle Bug: T176526 Change-Id: I7b692def1695119291b26b2f2d25064af9e621f7 --- RELEASE-NOTES-1.32 | 3 +++ includes/EditPage.php | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index 5dbf873c86..731f874d16 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -211,6 +211,9 @@ because of Phabricator reports. it had unexpected behavior (only marking text if it looked like a URL) and was only used in a single place in the code. Use LanguageConverter::markNoConversion() instead. +* (T176526) EditPage::getContextTitle() falling back to $wgTitle when the + context title is unset is now deprecated; anything creating an EditPage + instance should set the context title via ::setContextTitle(). === Other changes in 1.32 === * … diff --git a/includes/EditPage.php b/includes/EditPage.php index 9aa65505df..92097616f7 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -486,17 +486,15 @@ class EditPage { /** * Get the context title object. - * If not set, $wgTitle will be returned. This behavior might change in - * the future to return $this->mTitle instead. + * + * If not set, $wgTitle will be returned, but this is deprecated. This will + * throw an exception. * * @return Title */ public function getContextTitle() { if ( is_null( $this->mContextTitle ) ) { - wfDebugLog( - 'GlobalTitleFail', - __METHOD__ . ' called by ' . wfGetAllCallers( 5 ) . ' with no title set.' - ); + wfDeprecated( __METHOD__ . ' called with no title set', '1.32' ); global $wgTitle; return $wgTitle; } else { -- 2.20.1