Opened 10 years ago
Closed 10 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)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Correct regex formulation