aboutsummaryrefslogtreecommitdiffstats
path: root/includes/htmlform/HTMLFormField.php
diff options
context:
space:
mode:
authorMax Semenik <maxsem.wiki@gmail.com>2017-06-29 17:13:12 -0700
committerMax Semenik <maxsem.wiki@gmail.com>2017-08-01 20:32:20 -0700
commitfd6e9ef2d481209b01fa6e1bb1c863b8257f0272 (patch)
treef47713c63fdb6c8970faaa1a2d8ac7e69b3c61ab /includes/htmlform/HTMLFormField.php
parent1f2c768a9df46909932b44443f733d2185517435 (diff)
downloadmediawikicore-fd6e9ef2d481209b01fa6e1bb1c863b8257f0272.tar.gz
mediawikicore-fd6e9ef2d481209b01fa6e1bb1c863b8257f0272.zip
Human-readable section ID support
It adds the ability to replace the current section ID escaping schema (.C0.DE) with a HTML5-compliant escaping schema that is displayed as Unicode in many modern browsers. See the linked bug for discussion of various options that were considered before the implementation. A few remarks: * Because Sanitizer::escapeId() is used in a bunch of places without escaping, I'm deprecating it without altering its behavior. * The bug described in comments for Parser::guessLegacySectionNameFromWikiText() is still there in some Edge versions that display mojibake. Bug: T152540 Change-Id: Id304010a0342efbb7ef2d56c5b8b244f2e4fb2c5
Diffstat (limited to 'includes/htmlform/HTMLFormField.php')
-rw-r--r--includes/htmlform/HTMLFormField.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php
index 7cb83e21cd75..77ddc1a1b5ec 100644
--- a/includes/htmlform/HTMLFormField.php
+++ b/includes/htmlform/HTMLFormField.php
@@ -416,8 +416,8 @@ abstract class HTMLFormField {
$this->mDir = $params['dir'];
}
- $validName = Sanitizer::escapeId( $this->mName );
- $validName = str_replace( [ '.5B', '.5D' ], [ '[', ']' ], $validName );
+ $validName = urlencode( $this->mName );
+ $validName = str_replace( [ '%5B', '%5D' ], [ '[', ']' ], $validName );
if ( $this->mName != $validName && !isset( $params['nodata'] ) ) {
throw new MWException( "Invalid name '{$this->mName}' passed to " . __METHOD__ );
}
@@ -430,7 +430,7 @@ abstract class HTMLFormField {
if ( isset( $params['id'] ) ) {
$id = $params['id'];
- $validId = Sanitizer::escapeId( $id );
+ $validId = urlencode( $id );
if ( $id != $validId ) {
throw new MWException( "Invalid id '$id' passed to " . __METHOD__ );