summaryrefslogtreecommitdiff
path: root/includes/SkinTemplate.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/SkinTemplate.php')
-rw-r--r--includes/SkinTemplate.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php
index cfb67250..023afdd8 100644
--- a/includes/SkinTemplate.php
+++ b/includes/SkinTemplate.php
@@ -549,11 +549,22 @@ class SkinTemplate extends Skin {
/* set up the default links for the personal toolbar */
$personal_urls = array();
- $page = $wgRequest->getVal( 'returnto', $this->thisurl );
- $query = $wgRequest->getVal( 'returntoquery', $this->thisquery );
- $returnto = "returnto=$page";
- if( $this->thisquery != '' )
- $returnto .= "&returntoquery=$query";
+
+ # Due to bug 32276, if a user does not have read permissions,
+ # $wgOut->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( $wgRequest->getVal( 'title', '' ) );
+ $page = $wgRequest->getVal( 'returnto', $page );
+ $returnto = '';
+ if( strval( $page ) !== '' ) {
+ $returnto = "returnto=$page";
+ $query = $wgRequest->getVal( 'returntoquery', $this->thisquery );
+ if( $query != '' ) {
+ $returnto .= "&returntoquery=$query";
+ }
+ }
+
if( $this->loggedin ) {
$personal_urls['userpage'] = array(
'text' => $this->username,