jenkins-bot has submitted this change and it was merged.
Change subject: Don't split regex string unnecessarily
......................................................................
Don't split regex string unnecessarily
Change-Id: Id5912e64916ce5c7be2991478c32531596917540
---
M includes/parser/Parser.php
1 file changed, 5 insertions(+), 5 deletions(-)
Approvals:
Umherirrender: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index fc7040a..46ba4b4 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -4384,7 +4384,7 @@
# links - this is for later, but we need the number of
headlines right now
$matches = array();
$numMatches = preg_match_all(
- '/<H(?P<level>[1-6])(?P<attrib>.*?' .
'>)\s*(?P<header>[\s\S]*?)\s*<\/H[1-6] *>/i',
+
'/<H(?P<level>[1-6])(?P<attrib>.*?>)\s*(?P<header>[\s\S]*?)\s*<\/H[1-6] *>/i',
$text,
$matches
);
@@ -4538,8 +4538,8 @@
# 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 @@
$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 @@
}
# split up and insert constructed headlines
- $blocks = preg_split( '/<H[1-6].*?' . '>[\s\S]*?<\/H[1-6]>/i',
$text );
+ $blocks = preg_split( '/<H[1-6].*?>[\s\S]*?<\/H[1-6]>/i', $text
);
$i = 0;
// build an array of document sections
--
To view, visit https://gerrit.wikimedia.org/r/186933
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id5912e64916ce5c7be2991478c32531596917540
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits