The line break converter filter ignores certain elements which may contain line breaks which should not be rendered as HTML breaks (e.g., script, style, pre). The object element is not ignored though so if any other filter allows this element then line breaks within the object element are converted into HTML breaks.

For example, if the embedfilter and the line break converter filter are both included in the same input format, the following content would be transformed as follows.

Before:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="400" height="326">
  <param name="width" value="400" />
  <param name="height" value="326" />
  <param name="src" value="http://video.google.com/googleplayer.swf?docId=-7408504973132978571&amp;hl=en-CA" />
  <embed type="application/x-shockwave-flash" width="400" height="326" src="http://video.google.com/googleplayer.swf?docId=-7408504973132978571&amp;hl=en-CA"></embed>
</object>

After:

<p><object classid="d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="400" height="326"></p>
<param name="width" value="400" />
<param name="height" value="326" />
<param name="src" value="http://video.google.com/googleplayer.swf?docId=-7408504973132978571&amp;hl=en-CA" />
  <embed type="application/x-shockwave-flash" width="400" height="326" src="http://video.google.com/googleplayer.swf?docId=-7408504973132978571&amp;amp;hl=en-CA"></embed><br />
</object></p>

I haven't investigated why only the linebreak following the embed child element is transformed but I suspect it's because that has a closing tag while the params do not. The paragraph element surrounding the object tag causes no issues but adding html breaks inside causes it to display improperly, in Firefox at a least.

The attached patch adds object to the small list of elements to ignore which resolves the issue.

CommentFileSizeAuthor
filter.module_34.patch1.01 KBtangent
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tangent’s picture

Status: Active » Needs review

Fixed status.

Freso’s picture

Status: Needs review » Reviewed & tested by the community

It apparently works as advertised and applies cleanly. I'm saying apparently since the change wasn't effective right after applying the patch, but I'm suspecting some cache mechanism was at work, as it works perfectly now. Also, it's a really simple patch that doesn't seem likely to break anything. Marking RTBC and then committer/another reviewer can determine whether or not this needs more work (to avoid the possibly-cache). I think it'd be safe to commit though, and I'm thinking this is the first and last patch I'm reviewing when it's several hours past bedtime. -.-

JirkaRybka’s picture

I think all filtered contents get cached, so it's necessary to either flush cache or submit a new (different) content to test this sort of thing properly. So I feel pretty safe to say, that the cache thing is unrelated and doesn't count against the patch being RTBC.

tangent’s picture

Actually, filters themselves are cached so any time an input format is modified the cache must be cleared to see the changes. It is unrelated to this patch.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

That looks correct to me. Committed to CVS HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)
Todd Nienkerk’s picture

Version: 6.x-dev » 5.x-dev
Status: Closed (fixed) » Patch (to be ported)

I just discovered the exact same behavior on a Drupal 5.12 site. The patch applies fine (with an offset) and resolves the error.

drumm’s picture

Status: Patch (to be ported) » Fixed

Applies cleanly to Drupal 5. Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.