From f64d87b12ac84f7c5d0e3d6915d9c9aa3246705d Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 30 Apr 2006 11:50:36 +0000 Subject: [PATCH] Fix 5487: escape self-closed HTML pair tags + parsertest. --- RELEASE-NOTES | 2 +- includes/Sanitizer.php | 4 ++++ maintenance/parserTests.txt | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 250181a563..f790e0a1e1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -155,7 +155,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 5284) Special redirect pages should remember parameters * Suppress 7za output on dumpBackup * (bug 5338) Reject extra initial colons in title - + (bug 5487) Escape self-closed HTML pair tags. == Compatibility == diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 21ea4d9842..45277d5270 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -401,6 +401,10 @@ class Sanitizer { } else if ( in_array( $t, $tagstack ) && ! in_array ( $t , $htmlnest ) ) { $badtag = 1 ; + # Is it a self closed htmlpair ? (bug 5487) + } else if( $brace == '/>' && + in_array($t, $htmlpairs) ) { + $badtag = 1; } elseif( in_array( $t, $htmlsingleonly ) ) { # Hack to force empty tag for uncloseable elements $brace = '/>'; diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index b692b088fe..4d05607890 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -3775,6 +3775,17 @@ all additional text is vanished

!! end +!! test +Self closed html pairs (bug 5487) +!! options +!! input +
Centered text
+
In div text
+!! result +
<font id="bug" />Centered text
+
<font id="bug2" />In div text
+ +!! end TODO: more images -- 2.20.1