* (bug 3202) Attributes now allowed on <pre> tags
* Sanitizer::validateTagAttributes now available to discard illegal/unsafe
attribute values from an array.
+* (bug 3837) Leave <center> as is instead of doing an unsafe text replacement
+ to <div class="center">. <center> is perfectly valid in the target doctype
+ (XHTML 1.0 Transitional), while the replacement didn't catch all cases and
+ could even result in invalid output from valid input.
== Compatibility ==
'/(.) (?=\\?|:|;|!|\\302\\273)/' => '\\1 \\2',
# french spaces, Guillemet-right
'/(\\302\\253) /' => '\\1 ',
- '/<center *>(.*)<\\/center *>/i' => '<div class="center">\\1</div>',
);
$text = preg_replace( array_keys($fixtags), array_values($fixtags), $text );
wfProfileIn( "$fname-paragraph" );
# No prefix (not in list)--go to paragraph mode
// XXX: use a stack for nestable elements like span, table and div
- $openmatch = preg_match('/(<table|<blockquote|<h1|<h2|<h3|<h4|<h5|<h6|<pre|<tr|<p|<ul|<ol|<li|<\\/tr|<\\/td|<\\/th)/iS', $t );
+ $openmatch = preg_match('/(<table|<blockquote|<h1|<h2|<h3|<h4|<h5|<h6|<pre|<tr|<p|<ul|<ol|<li|<center|<\\/tr|<\\/td|<\\/th)/iS', $t );
$closematch = preg_match(
'/(<\\/table|<\\/blockquote|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|'.
- '<td|<th|<div|<\\/div|<hr|<\\/pre|<\\/p|'.$this->mUniqPrefix.'-pre|<\\/li|<\\/ul|<\\/ol)/iS', $t );
+ '<td|<th|<div|<\\/div|<hr|<\\/pre|<\\/p|'.$this->mUniqPrefix.'-pre|<\\/li|<\\/ul|<\\/ol|<\\/center)/iS', $t );
if ( $openmatch or $closematch ) {
$paragraphStack = false;
# TODO bug 5718: paragraph closed
<center><font id="bug" />Centered text</center>
<div><font id="bug2" />In div text</div>
!! result
-<div class="center"><font id="bug" />Centered text</div>
+<center><font id="bug" />Centered text</center>
<div><font id="bug2" />In div text</div>
!! end