Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.213 diff -u -p -r1.213 filter.module --- modules/filter/filter.module 6 May 2008 12:18:47 -0000 1.213 +++ modules/filter/filter.module 3 Jun 2008 22:48:41 -0000 @@ -751,7 +751,7 @@ function _filter_htmlcorrector($text) { } // Properly entify angles. - $text = preg_replace('!<([^a-zA-Z/])!', '<\1', $text); + $text = preg_replace('@<([^a-zA-Z!/])@', '<\1', $text); // Split tags from text. $split = preg_split('/<([^>]+?)>/', $text, -1, PREG_SPLIT_DELIM_CAPTURE); @@ -786,13 +786,16 @@ function _filter_htmlcorrector($text) { if (count($stack) && ($stack[0] == $tagname) && isset($no_nesting[$stack[0]])) { $output .= ''; } - // Push non-single-use tags onto the stack - if (!isset($single_use[$tagname])) { - array_unshift($stack, $tagname); - } - // Add trailing slash to single-use tags as per X(HT)ML. - else { - $value = rtrim($value, ' /') . ' /'; + // Ensure we're not closing a HTML comment. + if ($tagname{0} != '!') { + // Push non-single-use tags onto the stack + if (!isset($single_use[$tagname])) { + array_unshift($stack, $tagname); + } + // Add trailing slash to single-use tags as per X(HT)ML. + else { + $value = rtrim($value, ' /') . ' /'; + } } $output .= '<' . $value . '>'; }