r104261 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104260‎ | r104261 | r104262 >
Date:00:15, 26 November 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Bug 32649 - Many undefined variables when making language links

Only append querystring if one exists
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -364,10 +364,12 @@
365365 }
366366 $fragmentDelimiter = ( isset( $parsedUrl['fragment'] ) && $parsedUrl['fragment'] !== null ) ? '#' : '';
367367 $queryDelimiter = ( isset( $parsedUrl['query'] ) && $parsedUrl['query'] !== null ) ? '?' : '';
368 - $languageUrl = $parsedUrl['scheme'] . $parsedUrl['delimiter'] . $parsedUrl['host']
369 - . $parsedUrl['path'] . $queryDelimiter . $parsedUrl['query']
370 - . $fragmentDelimiter . $parsedUrl['fragment'];
371368
 369+ $languageUrl = $parsedUrl['scheme'] . $parsedUrl['delimiter'] . $parsedUrl['host'] . $parsedUrl['path'];
 370+ if ( isset( $parsedUrl['query'] ) ) {
 371+ $languageUrl .= $queryDelimiter . $parsedUrl['query'] . $fragmentDelimiter . $parsedUrl['fragment'];
 372+ }
 373+
372374 $languageUrls[] = array(
373375 'href' => $languageUrl,
374376 'text' => ( $wgContLang->getLanguageName( $nt->getInterwiki() ) != ''

Follow-up revisions

RevisionCommit summaryAuthorDate
r106340Followup r104261, don't apply fragment depending on whether there is a query ...reedy17:27, 15 December 2011

Comments

#Comment by Catrope (talk | contribs)   16:39, 15 December 2011
+				$languageUrl = $parsedUrl['scheme'] . $parsedUrl['delimiter'] .	 $parsedUrl['host'] . $parsedUrl['path'];
+				if ( isset( $parsedUrl['query'] ) ) {
+					$languageUrl .= $queryDelimiter . $parsedUrl['query'] . $fragmentDelimiter . $parsedUrl['fragment'];
+				}
+

This breaks if there is a fragment but no query string.

Status & tagging log