From 6b3251e931d01a9095b320ce12179cb9fe9dff63 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 7 Aug 2014 19:11:18 +0000 Subject: [PATCH] wptexturize: After [28727], leverage RegeEx possessives (++) to improve performance and avoid libpcre segfaults. Props kovshenin. Fixes #12690. Built from https://develop.svn.wordpress.org/trunk@29431 git-svn-id: http://core.svn.wordpress.org/trunk@29209 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 416d301dd9..becc24a175 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -219,7 +219,7 @@ function wptexturize($text, $reset = false) { . '[^\[\]<>]' // Shortcodes do not contain other shortcodes. . '|' . '<[^>]+>' // HTML elements permitted. Prevents matching ] before >. - . ')+' + . ')++' . '\]' // Find end of shortcode. . '\]?' // Shortcodes may end with ]] . ')/s'; @@ -241,12 +241,12 @@ function wptexturize($text, $reset = false) { continue; - } elseif ( '[' === $first && 1 === preg_match( '/^\[(?:[^\[\]<>]|<[^>]+>)+\]$/', $curl ) ) { + } elseif ( '[' === $first && 1 === preg_match( '/^\[(?:[^\[\]<>]|<[^>]+>)++\]$/', $curl ) ) { // This is a shortcode delimeter. _wptexturize_pushpop_element( $curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes ); - } elseif ( '[' === $first && 1 === preg_match( '/^\[\[?(?:[^\[\]<>]|<[^>]+>)+\]\]?$/', $curl ) ) { + } elseif ( '[' === $first && 1 === preg_match( '/^\[\[?(?:[^\[\]<>]|<[^>]+>)++\]\]?$/', $curl ) ) { // This is an escaped shortcode delimeter. // Do not texturize.