If you have the HTML corrector filter enabled (e.g. using the Full HTML format that ships with Drupal) and create content containing e.g. <div></div> or <iframe></iframe>, the filter will transform these into a single self-closed tag, e.g. <div /> or <iframe />.

This is incorrect; not all HTML tags are allowed to be self-closed like that.

A practical example where this causes a problem (and where I discovered the bug) is if you try to paste an embedded Google Map into a textarea. This uses an iframe, and when the filter attempts to self-close that tag for you, it causes all HTML content on the page that occurs after the iframe to not be rendered at all.

We should either have a list of tags that the HTML corrector should not self-close, or perhaps have it not self-close anything? (Its purpose is only to make sure the HTML is valid, and getting rid of existing closing tags doesn't seem relevant for that.)

Comments

David_Rothstein’s picture

Looking into it a bit more, this is a regression from D6.

The fundamental cause appears to be that in D7 this filter is using XML-related functions to output XHTML. Note that a fix/workaround for this kind of issue is provided here:
http://www.php.net/manual/en/domdocument.savexml.php#95252

David_Rothstein’s picture

Status: Active » Needs review
StatusFileSize
new6.23 KB

This is tricky stuff, but here is a patch that should solve it (with documentation and tests).

Status: Needs review » Needs work

The last submitted patch, filter-html-corrector-766332-2.patch, failed testing.

David_Rothstein’s picture

Status: Needs work » Needs review
StatusFileSize
new6.98 KB

Fixing those.

pwolanin’s picture

David_Rothstein’s picture

Status: Needs review » Closed (duplicate)

Oops, yeah...

I changed the title of that issue to reflect the (new) topic that it apparently evolved into - the out of date title was why I missed it - and moved some of the tests I wrote over to that one.