WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/07/2014 07:10:13 PM (6 years ago)
Author:
wonderboymusic
Message:

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

Props kovshenin.
Fixes #12690.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r29316 r29431  
    220220        .   '|'
    221221        .       '<[^>]+>'   // HTML elements permitted. Prevents matching ] before >.
    222         .   ')+'
     222        .   ')++'
    223223        .   '\]'        // Find end of shortcode.
    224224        .   '\]?'       // Shortcodes may end with ]]
     
    242242            continue;
    243243
    244         } elseif ( '[' === $first && 1 === preg_match( '/^\[(?:[^\[\]<>]|<[^>]+>)+\]$/', $curl ) ) {
     244        } elseif ( '[' === $first && 1 === preg_match( '/^\[(?:[^\[\]<>]|<[^>]+>)++\]$/', $curl ) ) {
    245245            // This is a shortcode delimeter.
    246246
    247247            _wptexturize_pushpop_element( $curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes );
    248248
    249         } elseif ( '[' === $first && 1 === preg_match( '/^\[\[?(?:[^\[\]<>]|<[^>]+>)+\]\]?$/', $curl ) ) {
     249        } elseif ( '[' === $first && 1 === preg_match( '/^\[\[?(?:[^\[\]<>]|<[^>]+>)++\]\]?$/', $curl ) ) {
    250250            // This is an escaped shortcode delimeter.
    251251
Note: See TracChangeset for help on using the changeset viewer.