| Project: | Drupal core |
| Version: | 6.22 |
| Component: | filter.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (to be ported) |
Issue Summary
The line break converter filter as of Drupal 6.17 is failing to handle HTML comments properly. HTML comments like <!-- please ignore this --> are being doubled up. HTML comments which are inside a paragraph -- inline sort of -- cause the paragraph to be split in two paragraphs and thus an unwanted line break is introduced. I experience this problem on all of the 6.17 Drupal systems I am maintaining, which are vastly different in age, configuration, and underlying operating system and PHP version.
To reproduce the problem simply add an HTML comment into the body -- like in the example below --, select an input format with line break converter and without HTML filter, normally "Full HTML", and look at the source of the page created.
Body text:
Ultrices odio et sed, integer, cum, pulvinar cras nunc proin nec pulvinar, augue non diam magna! Ultrices velit purus <!-- leave me alone --> elementum dictumst, scelerisque, amet tristique amet non enim pellentesque ac sit, sagittis dis pulvinar cursus ac etiam, a dignissim porttitor integer.becomes browser source code:
<p>Ultrices odio et sed, integer, cum, pulvinar cras nunc proin nec pulvinar, augue non diam magna! Ultrices velit purus </p>
<!-- leave me alone --><!-- leave me alone --><p> elementum dictumst, scelerisque, amet tristique amet non enim pellentesque ac sit, sagittis dis pulvinar cursus ac etiam, a dignissim porttitor integer.</p>This behavior introduces unwanted line breaks, and is a nuisance when HTML comments are being further processed like being replaced by something else.
Why are HTML comments not ignored by the line break converter as it used to be?
This may or may not be related/caused by the change discussed at http://drupal.org/node/133188
Comments
#1
Marked #842482: Line break bug as a duplicate.
#2
narf...
#3
As happy news, this issue is not present in Drupal 7.
#4
Any news about this bug? Have you, hd, tested if the patch at http://drupal.org/node/133188 also solves the problem with double html comments?
Regards.
#5
might be a duplicate of #222926: HTML Corrector filter escapes HTML comments
#6
I don't have HTML corrector active in my site and I'm experiencing this issue.
#7
Bug still present in 6.19.
#8
There was code added to the filter module to ensure that comments in the code would make it into the final code.
For me, the problem is the fact that the comments were being doubled up, which was a problem when javascript blocks were surrounded by comment marks which meant that javascript blocks would appear twice.
The attached patch only ensures that the comment sections only appear once. It's a simple patch - it adds a missing "continue" statement to ensure that the comments aren't added to the output twice.
#9
#10
The last submitted patch, filter.module.patch, failed testing.
#11
Still happening in 6.20 I could re-roll the last patch, but if I understand correctly, it only solves the problem of duplicating the comment in the final markup, and does not solve the problem of splitting paragraphs.
Since this is apparently not a problem in Drupal seven, could we identify what is different in the code there?
-Josh
#12
I re-rolled the patch.
#13
Don't use this!
I made a mistake in this patch, and am posting a proper one below.
(I would delete this if I could.)
#14
Re-rolled the patch from #8.
#15
Thx for this patch.
Works perfectly on 6.19
#16
Under 6.22 I have this problem and the patches here do not correct the issue, I am still getting double HTML comments.
Worse, it looks like some recent-ish versions of firefox will treat a double comment as a desire to show the comment to the user.
Any advice?