From: Anders Wegge Jakobsen Date: Sat, 3 Jun 2006 00:01:01 +0000 (+0000) Subject: Bug 6171: Sanitizing of HTML-elements with optional end tags. X-Git-Tag: 1.31.0-rc.0~56922 X-Git-Url: http://git.cyclocoop.org/%22.%20generer_url_ecrire%28%22sites_tous%22%2C%22%22%29.%20%22?a=commitdiff_plain;h=ddd59e0677855047b538273470d557c6e1af7ee9;p=lhc%2Fweb%2Fwiklou.git Bug 6171: Sanitizing of HTML-elements with optional end tags. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 792dda3c52..113f33e5ac 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -412,7 +412,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * New message sp-newimages-showfrom replaces rclistfrom on special:newimages * Improve handling of ;: definition list construct with overlapping or nested HTML tags - +* (bug 6171) Fix sanitizing of HTML-elements with an optional closing + tag. The sanitizer still needs to learn how to make well-formed XML + in this case. == Compatibility == diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 30c3a21209..f01759217c 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -367,8 +367,8 @@ class Sanitizer { $tabletags = array(); } - $htmlsingle = array_merge( $tabletags, $htmlsingle ); - $htmlelements = array_merge( $htmlsingle, $htmlpairs ); + $htmlsingleallowed = array_merge( $htmlsingle, $tabletags ); + $htmlelements = array_merge( $htmlsingle, $htmlpairs, $htmlnest ); # Remove HTML comments $text = Sanitizer::removeHTMLcomments( $text ); @@ -391,10 +391,28 @@ class Sanitizer { if( in_array( $t, $htmlsingleonly ) ) { $badtag = 1; } elseif ( ( $ot = @array_pop( $tagstack ) ) != $t ) { - @array_push( $tagstack, $ot ); - #
  • can be nested in