Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#31212 closed defect (bug) (fixed)

oEmbed discovery fails on XHTML head links

Reported by: cweiske's profile cweiske Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.1
Component: Embeds Keywords: has-patch
Focuses: Cc:

Description

In XHTML, link tags in the HTML head need to be closed:

<link title="test" href="http://example.org/test"/>

Wordpress' oEmbed discovery in WP_oEmbed::discover() fails on this.
It extracts the attributes ( title="test" href="http://example.org/test"/) and sends it through shortcode_parse_atts. The trailing slash is included even though it's not part of the attributes.

Either discover()'s link tag should not match the slash, or shortcode_parse_atts should be changed to cope with it.

Attachments (1)

fix-31212.diff (786 bytes) - added by cweiske 10 years ago.
Patch that fixes the problem.

Download all attachments as: .zip

Change History (4)

@cweiske
10 years ago

Patch that fixes the problem.

#1 @wonderboymusic
10 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.2

#2 @wonderboymusic
10 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 31407:

oEmbed discovery fails on XHTML head links, adjust the regex to not match /.

Props cweiske.
Fixes #31212.

#3 @nacin
9 years ago

In general, I'd argue that /U (PCRE_UNGREEDY) should not be used. It isn't natural to read a regular expression as if things are un-greedy; using ? to make something lazy/reluctant/nongreedy is going to be easier to understand.

/U is also sometimes misread as /u which is for UTF-8 (and also should not be used in many cases).

Note: See TracTickets for help on using tickets.