From 08d14337cce18b5d2377713628664369ab500af0 Mon Sep 17 00:00:00 2001 From: Marius Hoch Date: Wed, 24 Oct 2012 01:18:08 +0200 Subject: [PATCH] (bug 36053) Login returnto doesn't work if title isn't in the URI Returnto after login didn't work if title wasn't given as URI parameter. I'm using $this->getTitle() to find it out, in case the user got read rights (per code comment above my change). Change-Id: I14d92581ce790355404d3c184fa6542a24f7a130 --- RELEASE-NOTES-1.21 | 2 ++ includes/SkinTemplate.php | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index 7c932eff11..5abdd1efed 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -77,6 +77,8 @@ production. * (bug 2865) User interface HTML elements don't use lang attribute (completed the fix by adding the lang attribute to firstHeading) * (bug 42173) Removed namespace prefixes on Special:UncategorizedCategories. +* (bug 36053) Log in "returnto" feature forgets query parameters if no + title parameter was specified. === API changes in 1.21 === * prop=revisions can now report the contentmodel and contentformat, see docs/contenthandler.txt diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 341983d311..173d37af6f 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -555,7 +555,11 @@ class SkinTemplate extends Skin { # $this->getTitle() will just give Special:Badtitle, which is # not especially useful as a returnto parameter. Use the title # from the request instead, if there was one. - $page = Title::newFromURL( $request->getVal( 'title', '' ) ); + if ( $this->getUser()->isAllowed( 'read' ) ) { + $page = $this->getTitle(); + } else { + $page = Title::newFromText( $request->getVal( 'title', '' ) ); + } $page = $request->getVal( 'returnto', $page ); $a = array(); if ( strval( $page ) !== '' ) { -- 2.20.1