Opened 4 years ago
Last modified 2 years ago
#10033 new defect (bug)
wptexturize and wpautop problems with html comments and object tags
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Formatting | Version: | 2.8 |
| Severity: | minor | Keywords: | needs-patch |
| Cc: | norbert@… |
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]>–><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]>–><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 (9)
comment:1
markjaquith — 3 years ago
- Milestone changed from 2.9 to 3.0
comment:2
Viper007Bond — 3 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.
comment:3
Viper007Bond — 3 years ago
The wpautop() issue could also affect normal embeds (i.e. oEmbed).
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.
- Cc norbert@… added
The wptexturize part will be fixed to skip HTML tags in #4539.

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