r49645 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49644‎ | r49645 | r49646 >
Date:17:07, 19 April 2009
Author:simetrical
Status:ok
Tags:
Comment:
Fix braindead wrong escaping from r49017, r49018

URL encoding != HTML encoding!

Thanks for report by Tbleher at:

http://www.mediawiki.org/wiki/Special:Code/MediaWiki/49017#c2228
Modified paths:
  • /trunk/phase3/includes/ChangesList.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ChangesList.php
@@ -578,13 +578,13 @@
579579 if ( $rc_type != RC_NEW ) {
580580 $curLink = $this->message['cur'];
581581 } else {
582 - $curUrl = wfUrlencode( $rc->getTitle()->getLinkUrl( $querycur ) );
 582+ $curUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querycur ) );
583583 $curLink = "<a href=\"$curUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['cur']}</a>";
584584 }
585585 $diffLink = $this->message['diff'];
586586 } else {
587 - $diffUrl = wfUrlencode( $rc->getTitle()->getLinkUrl( $querydiff ) );
588 - $curUrl = wfUrlencode( $rc->getTitle()->getLinkUrl( $querycur ) );
 587+ $diffUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querydiff ) );
 588+ $curUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querycur ) );
589589 $diffLink = "<a href=\"$diffUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['diff']}</a>";
590590 $curLink = "<a href=\"$curUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['cur']}</a>";
591591 }
Index: trunk/phase3/includes/Title.php
@@ -854,6 +854,9 @@
855855 * there's a fragment but the prefixed text is empty, we just return a link
856856 * to the fragment.
857857 *
 858+ * The result obviously should not be URL-escaped, but does need to be
 859+ * HTML-escaped if it's being output in HTML.
 860+ *
858861 * @param $query \type{\arrayof{\string}} An associative array of key => value pairs for the
859862 * query string. Keys and values will be escaped.
860863 * @param $variant \type{\string} Language variant of URL (for sr, zh..). Ignored

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r49017Remove a couple of link() calls in enhanced RC...simetrical17:09, 29 March 2009
r49018Pass query directly to getLinkUrl()simetrical17:13, 29 March 2009

Status & tagging log