Skip to content

Commit

Permalink
wptexturize: After [28727], leverage RegeEx possessives (++) to impro…
Browse files Browse the repository at this point in the history
…ve 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
  • Loading branch information
staylor committed Aug 7, 2014
1 parent b053fe2 commit 6b3251e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wp-includes/formatting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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.
Expand Down

0 comments on commit 6b3251e

Please sign in to comment.