(bug 36053) Login returnto doesn't work if title isn't in the URI
authorMarius Hoch <hoo@online.de>
Tue, 23 Oct 2012 23:18:08 +0000 (01:18 +0200)
committerBrad Jorsch <bjorsch@wikimedia.org>
Tue, 20 Nov 2012 13:45:11 +0000 (08:45 -0500)
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
includes/SkinTemplate.php

index 7c932ef..5abdd1e 100644 (file)
@@ -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
index 341983d..173d37a 100644 (file)
@@ -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 ) !== '' ) {