wptexturize: After [28727], leverage RegeEx possessives (++) to improve performance and avoid libpcre segfaults.

Props kovshenin.
Fixes #12690.


git-svn-id: https://develop.svn.wordpress.org/trunk@29431 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-08-07 19:10:13 +00:00
parent 7f000f2fdd
commit 3aa94852b3
1 changed files with 3 additions and 3 deletions

View File

@ -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.