From: jenkins-bot Date: Tue, 21 Nov 2017 21:18:46 +0000 (+0000) Subject: Merge "Sanitizer::safeEncodeAttribute(): also encode ]" X-Git-Tag: 1.31.0-rc.0~1439 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=962529515d74517bd936bcb4546cecb5d28cdd91;hp=a88aff710b197533e388943306d7af5f9706f1be;p=lhc%2Fweb%2Fwiklou.git Merge "Sanitizer::safeEncodeAttribute(): also encode ]" --- diff --git a/includes/parser/Sanitizer.php b/includes/parser/Sanitizer.php index 7c9f56326b..20fee2db29 100644 --- a/includes/parser/Sanitizer.php +++ b/includes/parser/Sanitizer.php @@ -1150,6 +1150,7 @@ class Sanitizer { '{' => '{', '}' => '}', // prevent unpaired language conversion syntax '[' => '[', + ']' => ']', "''" => '''', 'ISBN' => 'ISBN', 'RFC' => 'RFC', diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index a505cde6d4..6e9f9447d3 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -17774,7 +17774,7 @@ T4304: HTML attribute safety (link) !! wikitext
!! html -
+
!! end @@ -17837,7 +17837,7 @@ T4304: HTML attribute safety (named web link) !! wikitext
!! html -
+
!! end @@ -29705,3 +29705,27 @@ wgFragmentMode=[ 'html5', 'legacy' ]

#Foo bar

!! end + +!! test +T51672: Test for brackets in attributes of elements in external link texts +!! wikitext +[http://example.com/ link span] +[http://example.com/ link span] + +!! html/php +

link span +link span +

+!! end + +!! test +T72875: Test for brackets in attributes of elements in internal link texts +!! wikitext +[[Foo|link span]] +[[Foo|link span]] + +!! html/php +

link span +link span +

+!! end