[Filter] FULL HTML filter with HTML corrector enabled break comments <!-- ..... -->

chantra - June 10, 2008 - 21:07
Project:Drupal
Version:6.1
Component:filter.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

Step to reproduce:

- make sure Full html filter is set with HTML corrector enabled
- create a new block and add the following html:
-----------------
<script type="text/javascript">
<!--
google_ad_client = "pub-acdffggghh";
google_ad_slot = "4567890567";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
---------------

The resulting block will be displayed as:
------------------
<script type="text/javascript">
&lt;!--
google_ad_client = "pub-acdffggghh";
google_ad_slot = "4567890567";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
----------------------

Note, the "<!--" is converted into "&lt;!--".
A side effect is that the javascript code will not work

The cause for this is at line 770 of modules/filter/filter.module:
// Properly entify angles.
$text = preg_replace('!<([^a-zA-Z/])!', '&lt;\1', $text);

Please see below a patch that is solving this issue.

AttachmentSizeStatusTest resultOperations
filter_drupal6_fix_comments.diff662 bytesIgnoredNoneNone

#1

chantra - June 10, 2008 - 21:16
Status:active» needs review

#2

gpk - June 11, 2008 - 18:41

This is actually a duplicate of http://drupal.org/node/222926 but your patch looks rather neater...

#3

sun - June 11, 2008 - 18:59
Status:needs review» duplicate

Marking as duplicate of #222926: htmlcorrector filter escapes HTML comments
Re-rolled and moved your patch over there.

 
 

Drupal is a registered trademark of Dries Buytaert.