WordPress.org

Make WordPress Core

Opened 10 years ago

Last modified 7 weeks ago

#10033 reopened defect (bug)

wpautop problems with html comments and object tags

Reported by: Denis-de-Bernardy Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 2.8
Component: Formatting Keywords: wpautop, needs-unit-tests, bulk-reopened
Focuses: Cc:

Description

Bumped into this one when upgrading my mediacaster plugin to use swfobject 2.1 (which is not 1.5 compatible), as documented here:

http://code.google.com/p/swfobject/wiki/documentation

I take it I'm not the only one who is going to need to upgrade a plugin. It's minor, since I'll just move the filter further down in the queue, but it's still worth reporting:

<object id="m544cf9700db147f751dc34ea1241d8bd" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="320" height="260">
<param name="movie" value="http://www.youtube.com/v/_nkZ3eHeXlc" />
<!--[if !IE]>-->

<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/_nkZ3eHeXlc" width="320" height="260">
<!--<![endif]-->
<p><a href="http://www.macromedia.com/go/getflashplayer">Get Flash 9.0</a> to see this player.</p>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
<script type="text/javascript">
//swfobject.registerObject("m544cf9700db147f751dc34ea1241d8bd", "9.0.0");
</script>

Gets turned into the following mess:

<object id="m544cf9700db147f751dc34ea1241d8bd" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="320" height="260"><param name="movie" value="http://www.youtube.com/v/_nkZ3eHeXlc" /><!--[if !IE]>&#8211;><br />
<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/_nkZ3eHeXlc" width="320" height="260"><br />
<!--<![endif]--></p>
<p><a href="http://www.macromedia.com/go/getflashplayer">Get Flash 9.0</a> to see this player.</p>
<p><!--[if !IE]>&#8211;><br />
</object><br />

<!--<![endif]--><br />
</object><br />
<script type="text/javascript">
//swfobject.registerObject("m544cf9700db147f751dc34ea1241d8bd", "9.0.0");
</script>

So, two/three issues:

  • wpautop should also ignore double object tags, and html comments
  • wptexturize should ignore html comments

Change History (16)

#1 @markjaquith
9 years ago

  • Milestone changed from 2.9 to 3.0

No patch. Does someone want to take a look at this for WP 3.0?

#2 @Viper007Bond
9 years ago

  • Keywords needs-patch added

Bumpy bump! I'd greatly appreciate this being fixed as I'm moving my video plugin over to using this type of embedding.

Not sure if I'm good enough with regex to make a patch myself though.

#3 @Viper007Bond
9 years ago

The wpautop() issue could also affect normal embeds (i.e. oEmbed).

#4 @rmccue
9 years ago

Related: #8912

#5 @ryan
9 years ago

  • Milestone changed from 3.0 to 3.1

#6 follow-up: @azaozz
9 years ago

For wpautop the fix is to ensure that there aren't any line breaks inside the <object> tag. There is a regex in it that tries to remove them (in both the php and JS versions) but it is not HTML comments aware.

The above example breaks because the IE conditionals are on new lines. We could add yet another regex to specifically check for HTML comments but it's generally better for plugins to remove any line breaks from complex <object> blocks when inserting them before wpautop (this is true for all complex HTML blocks too). The objects inserted by WordPress work properly.

#7 @nacin
8 years ago

  • Milestone changed from Awaiting Triage to Future Release

#8 follow-up: @norbertm
8 years ago

  • Cc norbert@… added

The wptexturize part will be fixed to skip HTML tags in #4539.

#9 in reply to: ↑ 8 @norbertm
8 years ago

Replying to norbertm:

The wptexturize part will be fixed to skip HTML tags in #4539.

Including test cases with #4539, specifically for the <!--[if !IE]>--> and <!--<![endif]--> sections.

#10 @nacin
5 years ago

  • Keywords wptexturize added

#11 @nacin
5 years ago

  • Keywords wpautop added

#12 @miqrogroove
5 years ago

  • Keywords wptexturize removed
  • Summary changed from wptexturize and wpautop problems with html comments and object tags to wpautop problems with html comments and object tags

See #8912 for wptexturize.

#13 in reply to: ↑ 6 @ericlewis
4 years ago

Replying to azaozz:

We could add yet another regex to specifically check for HTML comments

We could add a regex to get rid of any new lines within <object>s?

#14 @miqrogroove
4 years ago

  • Keywords needs-unit-tests added; needs-patch removed

Most of these issues should be resolved by 4.3.1 and earlier updates. Let's try to add relevant tests and see what's remaining to be fixed.

#15 @iseulde
4 months ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

This ticket has not seen any activity in over *two* years, so I'm closing it as "wontfix".

The ticket may lack decisiveness, may have become irrelevant, or may not have gathered enough interest.

If you think this ticket does deserve some attention again, feel free to reopen.

For bugs, it would be great if you could provide updated steps to reproduce against the latest version of WordPress (5.0.2 at the time of writing). Remember images or a video can be superior to explain a problem. At the very least, quickly test again to make sure the bug still exists.

If it’s an enhancement or feature, some extra motivation may help.

Thank you for your contributions to WordPress! <3

#16 @JeffPaul
7 weeks ago

  • Keywords bulk-reopened added
  • Milestone set to Awaiting Review
  • Resolution wontfix deleted
  • Status changed from closed to reopened

A decision was made to reopen tickets that were closed in the bulk edit that this ticket was affected by. This ticket is being placed back into the Awaiting Review milestone so it can be individually evaluated and verified to determine if it is still relevant/valid or reproducible.

Note: See TracTickets for help on using tickets.