Closed (outdated)
Project:
Drupal core
Version:
6.x-dev
Component:
filter.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Jun 2006 at 22:13 UTC
Updated:
2 Mar 2016 at 22:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
seanrDoesn't need to be multiline either, evidently:
<!--<br>test-->Comment #2
seanrThis patch completely removes the comment and it's content from the output before any other filters are applied (except the NULL replacement).
Comment #3
Steven commentedUnfortunately, the state of comments in HTML is vague:
<!--and end in-->.<!--and end in--, optional whitespace and>.<!, ends with>and contains an arbitrary amount of segments which each begin and end in--.I know that correct application of the SGML rule is one of the checks in the ACID2 browser compliancy test. So it would seem that the HTML specs only serve as simple examples of the SGML comment rules. The phrasing in the HTML specs is a bit vague anyway.
Part of ACID2:
Which one do we follow? Given that unremoved comments are still subject to the proper filtering later, it does not matter that much. What's important is that we catch the most common usage (which would be the HTML form, IMO).
Ungreedy matching should be avoided though.
For the 'stupid' HTML syntax, we should use
/<!--(-[^-]|[^-])*--\s*>/s.If we want to follow true SGML syntax, it needs to be
/<!(--(-[^-]|[^-])*)--\s*)*>/s.The code comment is misleading though, about "potentially nasty contents". HTML comments do not pose a security risk, for their 'potentially nasty' content is removed with or without this patch anyway. It is merely ugly and undesirable to print out any part of comments on screen.
Comment #4
magico commentedPushing this up!
@Steven: I think we should follow XHTML specification.
Comment #5
flevour commentedThis patch needs only opinionated opinions by someone of the core team.
I'd go for the XHTML one since it's the only one that I ever heard about.
I guess it's possible to setup an ugly regex that handles all three standards.
Cheers,
flevour
Comment #6
stevenpatzComment #7
stevenpatzrerolled for HEAD
Comment #8
Steven commentedThe ungreedy matching in the patch's regexp will cause a lot of unnecessary backtracking.
Comment #9
dpearcefl commentedIs this an issue in the current 6.X Drupal?