Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.204.2.1 diff -u -p -r1.204.2.1 filter.module --- modules/filter/filter.module 9 Apr 2008 21:11:47 -0000 1.204.2.1 +++ modules/filter/filter.module 3 Jun 2008 22:41:50 -0000 @@ -767,7 +767,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); @@ -802,13 +802,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 .'>'; }