From: Sam Reed Date: Tue, 27 Jan 2015 06:02:56 +0000 (+0000) Subject: Don't split regex string unnecessarily X-Git-Tag: 1.31.0-rc.0~12586 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=f41e2ddb6a0cdc6f7c32355215ffb25e907ba081;p=lhc%2Fweb%2Fwiklou.git Don't split regex string unnecessarily Change-Id: Id5912e64916ce5c7be2991478c32531596917540 --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index fc7040a0e1..46ba4b4742 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4384,7 +4384,7 @@ class Parser { # links - this is for later, but we need the number of headlines right now $matches = array(); $numMatches = preg_match_all( - '/[1-6])(?P.*?' . '>)\s*(?P
[\s\S]*?)\s*<\/H[1-6] *>/i', + '/[1-6])(?P.*?>)\s*(?P
[\s\S]*?)\s*<\/H[1-6] *>/i', $text, $matches ); @@ -4538,8 +4538,8 @@ class Parser { # to allow setting directionality in toc items. $tocline = preg_replace( array( - '#<(?!/?(span|sup|sub|bdi|i|b)(?: [^>]*)?>).*?' . '>#', - '#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|bdi|i|b))(?: .*?)?' . '>#' + '#<(?!/?(span|sup|sub|bdi|i|b)(?: [^>]*)?>).*?>#', + '#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|bdi|i|b))(?: .*?)?>#' ), array( '', '<$1>' ), $safeHeadline @@ -4547,7 +4547,7 @@ class Parser { $tocline = trim( $tocline ); # For the anchor, strip out HTML-y stuff period - $safeHeadline = preg_replace( '/<.*?' . '>/', '', $safeHeadline ); + $safeHeadline = preg_replace( '/<.*?>/', '', $safeHeadline ); $safeHeadline = Sanitizer::normalizeSectionNameWhitespace( $safeHeadline ); # Save headline for section edit hint before it's escaped @@ -4715,7 +4715,7 @@ class Parser { } # split up and insert constructed headlines - $blocks = preg_split( '/[\s\S]*?<\/H[1-6]>/i', $text ); + $blocks = preg_split( '/[\s\S]*?<\/H[1-6]>/i', $text ); $i = 0; // build an array of document sections