Only put returnto parameter if needed on the from-http redirect in Special:Userlogin
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Fri, 22 Nov 2013 19:36:17 +0000 (20:36 +0100)
committerIAlex <codereview@emsenhuber.ch>
Sat, 15 Mar 2014 21:09:41 +0000 (21:09 +0000)
The default value of the $mReturnTo and $mReturnToQuery member variables is '',
even if they were not passed. This means that they would always be present
in the redirected URL when accessing Special:Userlogin from HTTP and HTTPS
is available.

Now the special case '' is changed to null so that they don't appear anymore
if not needed.

Change-Id: I49a085feaa49d4b2954ff280db241234d2d46258

includes/specials/SpecialUserlogin.php

index bbe56ec..69013b0 100644 (file)
@@ -172,8 +172,9 @@ class LoginForm extends SpecialPage {
                if ( $this->mRequest->getProtocol() !== 'https' ) {
                        $title = $this->getFullTitle();
                        $query = array(
-                               'returnto' => $this->mReturnTo,
-                               'returntoquery' => $this->mReturnToQuery,
+                               'returnto' => $this->mReturnTo !== '' ? $this->mReturnTo : null,
+                               'returntoquery' => $this->mReturnToQuery !== '' ?
+                                       $this->mReturnToQuery : null,
                                'title' => null,
                        ) + $this->mRequest->getQueryValues();
                        $url = $title->getFullURL( $query, false, PROTO_HTTPS );