Merge "Ensure abort link parsing on xmlish tag in link title position"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 2 Mar 2018 18:55:37 +0000 (18:55 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 2 Mar 2018 18:55:37 +0000 (18:55 +0000)
includes/parser/Parser.php

index 2adfd0a..f6526ac 100644 (file)
@@ -2215,8 +2215,14 @@ class Parser {
                                $link = $origLink;
                        }
 
-                       $unstrip = $this->mStripState->unstripNoWiki( $link );
-                       $nt = is_string( $unstrip ) ? Title::newFromText( $unstrip ) : null;
+                       // \x7f isn't a default legal title char, so most likely strip
+                       // markers will force us into the "invalid form" path above.  But,
+                       // just in case, let's assert that xmlish tags aren't valid in
+                       // the title position.
+                       $unstrip = $this->mStripState->killMarkers( $link );
+                       $noMarkers = ( $unstrip === $link );
+
+                       $nt = $noMarkers ? Title::newFromText( $link ) : null;
                        if ( $nt === null ) {
                                $s .= $prefix . '[[' . $line;
                                continue;