jenkins-bot has submitted this change and it was merged.

Change subject: PrefixSearch: Avoid passing non-strings to Title::newFromText()
......................................................................


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
---
M includes/PrefixSearch.php
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Alex Monk: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/PrefixSearch.php b/includes/PrefixSearch.php
index 55a4f49..430b4b8 100644
--- a/includes/PrefixSearch.php
+++ b/includes/PrefixSearch.php
@@ -362,7 +362,11 @@
                        $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',

-- 
To view, visit https://gerrit.wikimedia.org/r/235675
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0dc3d91b6b4cfb97664aa6ca39c5c8f086d70db5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Alex Monk <kren...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to