From: Chad Horohoe Date: Thu, 3 Sep 2015 05:55:49 +0000 (-0700) Subject: PrefixSearch: Avoid passing non-strings to Title::newFromText() X-Git-Tag: 1.31.0-rc.0~10157^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=337b1e2e;p=lhc%2Fweb%2Fwiklou.git PrefixSearch: Avoid passing non-strings to Title::newFromText() We already handle the invalid title gracefully here anyway, so just rely on that behavior and just skip the Title construction bit :) Bug: T109975 Change-Id: I0dc3d91b6b4cfb97664aa6ca39c5c8f086d70db5 --- diff --git a/includes/PrefixSearch.php b/includes/PrefixSearch.php index 55a4f49b34..430b4b8972 100644 --- a/includes/PrefixSearch.php +++ b/includes/PrefixSearch.php @@ -362,7 +362,11 @@ abstract class PrefixSearch { $ns = NS_MAIN; // if searching on many always default to main } - $t = Title::newFromText( $search, $ns ); + $t = null; + if ( is_string( $search ) ) { + $t = Title::newFromText( $search, $ns ); + } + $prefix = $t ? $t->getDBkey() : ''; $dbr = wfGetDB( DB_SLAVE ); $res = $dbr->select( 'page',