From: Jack Phoenix Date: Mon, 4 May 2015 00:10:06 +0000 (+0300) Subject: Underscores etc. aren't valid in HTML IDs, so escape them properly X-Git-Tag: 1.31.0-rc.0~11505^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=9f286710dc290152d551ba2af4d1defbd307f428;p=lhc%2Fweb%2Fwiklou.git Underscores etc. aren't valid in HTML IDs, so escape them properly This was an issue where a skin's/extension's name would contain spaces, i.e. "Cologne Blue", "Renameuser for CentralAuth". Such a name would be passed as-is to the HTML ID, but spaces aren't valid in IDs, and this would in turn lead to HTML validation issues. Currently the English Wikipedia's Special:Version page has 26 validation issues and this patch fixes the supermajority of them. Change-Id: Ia197b0208fa2abfebbea1cb23f08822db2938162 --- diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 9a1c5e5df9..620c736150 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -842,7 +842,7 @@ class SpecialVersion extends SpecialPage { // Finally! Create the table $html = Html::openElement( 'tr', array( 'class' => 'mw-version-ext', - 'id' => "mw-version-ext-{$extension['name']}" + 'id' => Sanitizer::escapeId( 'mw-version-ext-' . $extension['name'] ) ) );