Don't parse <nowiki><span class="error"></nowiki>
authorBrad Jorsch <bjorsch@wikimedia.org>
Mon, 31 Oct 2016 20:37:26 +0000 (16:37 -0400)
committerKunal Mehta <legoktm@member.fsf.org>
Tue, 1 Nov 2016 03:10:36 +0000 (20:10 -0700)
Which means we can't check if a parser limit was exceeded while trying
to expand the content of a tag, but that's probably not a huge loss.
It'll just result in potentially strange output rather than an exception.

Bug: T149622
Change-Id: I7910dfa0f61b1cc9168c7ed1498b2bda27c47f0e

includes/parser/Parser.php
tests/parser/parserTests.txt

index 669e9fc..27c9535 100644 (file)
@@ -3801,11 +3801,10 @@ class Parser {
                        return $attrText;
                }
 
+               // We can't safely check if the expansion for $content resulted in an
+               // error, because the content could happen to be the error string
+               // (T149622).
                $content = !isset( $params['inner'] ) ? null : $frame->expand( $params['inner'] );
-               if ( substr( $content, 0, $errorLen ) === $errorStr ) {
-                       // See above
-                       return $content;
-               }
 
                $marker = self::MARKER_PREFIX . "-$name-"
                        . sprintf( '%08X', $this->mMarkerIndex++ ) . self::MARKER_SUFFIX;
index ba7b0d4..103acc6 100644 (file)
@@ -1420,6 +1420,15 @@ sed abit.
 </span></p>
 !! end
 
+!! test
+Don't parse <nowiki><span class="error"></nowiki> (T149622)
+!! wikitext
+<nowiki><span class="error"></nowiki>
+!! html/php
+<p>&lt;span class="error"&gt;
+</p>
+!! end
+
 !! test
 nowiki 3
 !! wikitext