From a31b2153b3415c55c46e15137060b496c706c724 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 18 Oct 2016 12:17:30 -0700 Subject: [PATCH] Add dotall modifier to EDITSECTION_REGEX The regex failed to match for input text like == == resulting in tags being leaked into the output. Change-Id: I3daade920d2de8cd3fc31fcaabf46ffe14b047d5 --- includes/parser/ParserOutput.php | 2 +- tests/parser/parserTests.txt | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 9dfa97cb5a..e9cdfcfb3d 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -213,7 +213,7 @@ class ParserOutput extends CacheTime { private $mMaxAdaptiveExpiry = INF; const EDITSECTION_REGEX = - '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)())#'; + '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)())#s'; // finalizeAdaptiveCacheExpiry() uses TTL = MAX( m * PARSE_TIME + b, MIN_AR_TTL) // Current values imply that m=3933.333333 and b=-333.333333 diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index ba7b0d462a..e12bc03f7d 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -513,6 +513,17 @@ Extra newlines between heading and content are swallowed

!! end +!! test +Heading with line break in nowiki +!! wikitext +== A B +C == +!! html +

A B +C[edit]

+ +!! end + !! test Parsing an URL !! wikitext -- 2.20.1