Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#29119 closed defect (bug) (fixed)

Wrong regex $yt_pattern to manage YouTube videos in wp_video_shortcode

Reported by: Fab1en Owned by:
Priority: normal Milestone: 4.0
Component: Media Version: 3.9.1
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

wp_video_shortcode uses the following regular expression to find YouTube videos and make them play correctly inside MediaElementJS player :

$yt_pattern = '#^https?://(:?www\.)?(:?youtube\.com/watch|youtu\.be/)#';

I think the :? in front of www and youtube are here to make the parenthesis non capturing. In this case this is incorrect : the right signs to use are ?:. The current formulation (:?) will optionally match a :.

Note that this is not really a bug, because there are no consequences : matches are not used afterward, and : will never appear in a URL at this place. But this is confusing and might cause a bug later.

Attachments (1)

29119.patch (440 bytes ) - added by Fab1en 12 years ago.
Correct regex formulation

Download all attachments as: .zip

Change History (4)

@Fab1en
12 years ago

Correct regex formulation

#1 @wonderboymusic
12 years ago

  • Keywords has-patch added
  • Milestone Awaiting Review4.0

This was probably my fault.

#2 @wonderboymusic
12 years ago

[29401] missed the ticket.

#3 @wonderboymusic
12 years ago

  • Resolutionfixed
  • Status newclosed
Note: See TracTickets for help on using tickets.