From: Tim Starling
Date: Tue, 18 Oct 2016 19:17:30 +0000 (-0700)
Subject: Add dotall modifier to EDITSECTION_REGEX
X-Git-Tag: 1.31.0-rc.0~4527^2
X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/modifier.php?a=commitdiff_plain;h=a31b2153b3415c55c46e15137060b496c706c724;p=lhc%2Fweb%2Fwiklou.git
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
---
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>))#';
+ '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)((?:mw:)?editsection>))#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
+
+
+!! end
+
!! test
Parsing an URL
!! wikitext