From e4c966d6ce59ef42260a4283d30af470229e2da5 Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Mon, 3 Dec 2018 13:48:38 +0100 Subject: [PATCH] Improve the matching of the youtube shortcode reversal again. Merges r184358-wpcom In D17568-code and D17868-code we improved this code. Those changes accidentally got reversed in D18511-code I was reviewing #10224 which would merge the original changes into Jetpack and noted the 's' modifier. Unfortunately we can't include that here because it means on long but malformed post content we go into an infinite loop because of the .*? in the RegEx. This means we can't match objects/mangled objects which have a newline within them but we can match more that we were Diff: D21652-code --- modules/shortcodes/youtube.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/shortcodes/youtube.php b/modules/shortcodes/youtube.php index f0aa1e1b35121..a86c456b4ddf0 100644 --- a/modules/shortcodes/youtube.php +++ b/modules/shortcodes/youtube.php @@ -32,7 +32,7 @@ function youtube_embed_to_short_code( $content ) { } // older codes - $regexp = '!]+?)>.*?]*?>.*?!is'; + $regexp = '!.*?.*?!i'; $regexp_ent = htmlspecialchars( $regexp, ENT_NOQUOTES ); $old_regexp = '!|>\s*)!'; $old_regexp_ent = str_replace( '&#0*58;', '&#0*58;|�*58;', htmlspecialchars( $old_regexp, ENT_NOQUOTES ) );