Fix 5487: escape self-closed HTML pair tags + parsertest.
authorAntoine Musso <hashar@users.mediawiki.org>
Sun, 30 Apr 2006 11:50:36 +0000 (11:50 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sun, 30 Apr 2006 11:50:36 +0000 (11:50 +0000)
RELEASE-NOTES
includes/Sanitizer.php
maintenance/parserTests.txt

index 250181a..f790e0a 100644 (file)
@@ -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 ==
 
index 21ea4d9..45277d5 100644 (file)
@@ -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 = '/>';
index b692b08..4d05607 100644 (file)
@@ -3775,6 +3775,17 @@ all additional text is vanished
 </p>
 !! end
 
+!! test
+Self closed html pairs (bug 5487)
+!! options
+!! input
+<center><font id="bug" />Centered text</center>
+<div><font id="bug2" />In div text</div>
+!! result
+<div class="center">&lt;font id="bug" /&gt;Centered text</div>
+<div>&lt;font id="bug2" /&gt;In div text</div>
+
+!! end
 
 TODO:
 more images