jenkins-bot has submitted this change and it was merged.

Change subject: Check hasTitle() in RequestContext::setWikiPage()
......................................................................


Check hasTitle() in RequestContext::setWikiPage()

Calling getTitle() right away can lead to reading from
$wgTitle, so check with hasTitle() first.

This avoids a globaltitlefail in ApiEditPage.

Change-Id: I749cc33dd4f1fd6bc7598be34f37e591d822c3f2
---
M includes/context/RequestContext.php
1 file changed, 1 insertion(+), 2 deletions(-)

Approvals:
  Anomie: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/context/RequestContext.php 
b/includes/context/RequestContext.php
index fe17fde..c76e3a9 100644
--- a/includes/context/RequestContext.php
+++ b/includes/context/RequestContext.php
@@ -182,9 +182,8 @@
         * @param WikiPage $p
         */
        public function setWikiPage( WikiPage $p ) {
-               $contextTitle = $this->getTitle();
                $pageTitle = $p->getTitle();
-               if ( !$contextTitle || !$pageTitle->equals( $contextTitle ) ) {
+               if ( !$this->hasTitle() || !$pageTitle->equals( 
$this->getTitle() ) ) {
                        $this->setTitle( $pageTitle );
                }
                // Defer this to the end since setTitle sets it to null.

-- 
To view, visit https://gerrit.wikimedia.org/r/179524
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I749cc33dd4f1fd6bc7598be34f37e591d822c3f2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Tpt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to