C. Scott Ananian has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/352179 )
Change subject: WIP: Protect broken wikilinks from being parsed as wikilinks later. ...................................................................... WIP: Protect broken wikilinks from being parsed as wikilinks later. Wikitext such as `[[Foo{{echo]]}}` get parsed as broken links by the preprocessor, but then end up being parsed as valid wikilinks later. This exposes the intermediate representation of the preprocessor and should be avoided. Change-Id: I0dd4512dc9014fc8e329e682be20184867cafe80 --- M includes/parser/Preprocessor_DOM.php M includes/parser/Preprocessor_Hash.php 2 files changed, 6 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/79/352179/1 diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 7539307..9bd1a16 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -966,6 +966,9 @@ } $s .= $part->out; } + // Break after first character so this doesn't get misparsed + // later. + $s = substr( $s, 0, 1 ) . '<nowiki/>' . substr( $s, 1 ); } return $s; } diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index 597d1f2..0bfd29e 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -795,6 +795,9 @@ substr( $this->open, -1 ), $openingCount - strlen( $s ) ); + // Break after first character so this doesn't get misparsed + // later. + $s = substr( $s, 0, 1 ) . '<nowiki/>' . substr( $s, 1 ); $accum = [ $s ]; $lastIndex = 0; $first = true; -- To view, visit https://gerrit.wikimedia.org/r/352179 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0dd4512dc9014fc8e329e682be20184867cafe80 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: C. Scott Ananian <canan...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits