From b8ced862bba14e25d3960638b9534c3c03b4c5ce Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 10 Jul 2015 11:12:15 -0700 Subject: [PATCH] Protect against non-text output from StripState going into Title::newFromText() 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 7f925901fd..83c2b0c253 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -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; -- 2.20.1