Protect against non-text output from StripState going into Title::newFromText()
authorChad Horohoe <chadh@wikimedia.org>
Fri, 10 Jul 2015 18:12:15 +0000 (11:12 -0700)
committerUmherirrender <umherirrender_de.wp@web.de>
Fri, 10 Jul 2015 20:05:06 +0000 (20:05 +0000)
Non-string input shouldn't be fed into newFromText(). We currently handle this
indirectly with relying on Title to do it. Instead just return earlier and not
try to construct a title from bad input.

Bug: T102321
Change-Id: I9bc96111378d9d4ed5981bffc6f150cbd0c1e331

includes/parser/Parser.php

index 7f92590..83c2b0c 100644 (file)
@@ -2147,7 +2147,8 @@ class Parser {
                                $link = substr( $link, 1 );
                        }
 
-                       $nt = Title::newFromText( $this->mStripState->unstripNoWiki( $link ) );
+                       $unstrip = $this->mStripState->unstripNoWiki( $link );
+                       $nt = is_string( $unstrip ) ? Title::newFromText( $unstrip ) : null;
                        if ( $nt === null ) {
                                $s .= $prefix . '[[' . $line;
                                continue;