WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#29119 closed defect (bug) (fixed)

Wrong regex $yt_pattern to manage YouTube videos in wp_video_shortcode

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

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 7 years ago.
Correct regex formulation

Download all attachments as: .zip

Change History (4)

@Fab1en
7 years ago

Correct regex formulation

#1 @wonderboymusic
7 years ago

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

This was probably my fault.

#2 @wonderboymusic
7 years ago

[29401] missed the ticket.

#3 @wonderboymusic
7 years ago

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.