wiki.techinc.nl/tests/phpunit/includes/parser
Bartosz Dziewoński 674e8388cb Preprocessor: Don't allow unclosed extension tags (matching until end of input)
(Previously done in f51d0d9a81 and
reverted in 543f46e9c08e0ff8c5e8b4e917fcc045730ef1bc.)

I think it's saner to treat this as invalid syntax, and output the
mismatched tag code verbatim. The current behavior is particularly
annoying for <ref> tags, which often swallow everything afterwards.

This does not affect HTML tags, though. Assuming Tidy is enabled, they
are still auto-closed at the end of the page content. (For tags that
"shadow" a HTML tag name, this results in the tag being treated as a
HTML tag. This currently only affects <pre> tags: if unclosed, they
are still displayed as preformatted text, but without suppressing
wikitext formatting.)

It also does not affect <includeonly>, <noinclude> and <onlyinclude>
tags. Changing this behavior now would be too disruptive to existing
content, and is the reason why previous attempt was reverted. (They
are already special-cased enough that this isn't too weird, for example
mismatched closing tags are hidden.)

Related to T17712 and T58306. I think this brings the PHP parser closer
to Parsoid's interpretation.

It reduces performance somewhat in the worst case, though. Testing with
https://phabricator.wikimedia.org/F3245989 (a 1 MB page starting with
3000 opening tags of 15 different types), parsing time rises from
~0.2 seconds to ~1.1 seconds on my setup. We go from O(N) to O(kN),
where N is bytes of input and k is the number of types of tags present
on the page. Maximum k shouldn't exceed 30 or so in reasonable setups
(depends on installed extensions, it's 20 on English Wikipedia).

Change-Id: Ide8b034e464eefb1b7c9e2a48ed06e21a7f8d434
2016-04-05 12:28:10 -07:00
..
MagicVariableTest.php Convert all array() syntax to [] 2016-02-17 01:33:00 -08:00
MediaWikiParserTest.php Convert all array() syntax to [] 2016-02-17 01:33:00 -08:00
NewParserTest.php parserTest: Remove mention of non-existent 'noxml' option 2016-03-24 00:48:02 +00:00
ParserMethodsTest.php Convert all array() syntax to [] 2016-02-17 01:33:00 -08:00
ParserOutputTest.php Convert all array() syntax to [] 2016-02-17 01:33:00 -08:00
ParserPreloadTest.php General cleanup of Parser tests 2013-10-23 12:26:15 +00:00
PreprocessorTest.php Preprocessor: Don't allow unclosed extension tags (matching until end of input) 2016-04-05 12:28:10 -07:00
TagHooksTest.php Convert all array() syntax to [] 2016-02-17 01:33:00 -08:00
TidyTest.php Convert all array() syntax to [] 2016-02-17 01:33:00 -08:00