Fix #6171 : magically close tags in tables when not using Tidy.
authorAntoine Musso <hashar@users.mediawiki.org>
Wed, 17 Jan 2007 20:55:26 +0000 (20:55 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Wed, 17 Jan 2007 20:55:26 +0000 (20:55 +0000)
RELEASE-NOTES
includes/Sanitizer.php

index 5b04d7f..0a8d986 100644 (file)
@@ -105,6 +105,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   $wgAutoConfirmCount (defaulting to zero, naturally).
 * (bug 8641) Fix order of updates to ipblocks table
 * (bug 8678) Fix detection of self-links for numeric titles in Parser
+* (bug 6171) Magically close tags in tables when not using Tidy.
 
 == Languages updated ==
 
index e5215b7..ad2f777 100644 (file)
@@ -354,7 +354,7 @@ class Sanitizer {
                                        'table', 'tr', 'td', 'th', 'div', 'blockquote', 'ol', 'ul',
                                        'dl', 'font', 'big', 'small', 'sub', 'sup', 'span'
                                );
-                               $tabletags = array( # Can only appear inside table
+                               $tabletags = array( # Can only appear inside table, we will close them
                                        'td', 'th', 'tr',
                                );
                                $htmllist = array( # Tags used by list
@@ -453,6 +453,10 @@ class Sanitizer {
                                                } else if( isset( $htmlsingle[$t] ) ) {
                                                        # Hack to not close $htmlsingle tags
                                                        $brace = NULL;
+                                               } else if( isset( $tabletags[$t] )
+                                               &&  in_array($t ,$tagstack) ) {
+                                                       // New table tag but forgot to close the previous one
+                                                       $text .= "</$t>";
                                                } else {
                                                        if ( $t == 'table' ) {
                                                                array_push( $tablestack, $tagstack );