From 53cd1dc9b9152b7eb8decebf8dc66080092c57a7 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Wed, 17 Jan 2007 20:55:26 +0000 Subject: [PATCH] Fix #6171 : magically close tags in tables when not using Tidy. --- RELEASE-NOTES | 1 + includes/Sanitizer.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 5b04d7f6c9..0a8d9861ad 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index e5215b7bc6..ad2f777d7d 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -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 .= ""; } else { if ( $t == 'table' ) { array_push( $tablestack, $tagstack ); -- 2.20.1