Merge "SpecialMovepage: Convert form to use OOUI controls"
[lhc/web/wiklou.git] / includes / PrefixSearch.php
index 2885679..430b4b8 100644 (file)
@@ -155,7 +155,10 @@ abstract class PrefixSearch {
                        }
                }
                $srchres = array();
-               if ( Hooks::run( 'PrefixSearchBackend', array( $namespaces, $search, $limit, &$srchres, $offset ) ) ) {
+               if ( Hooks::run(
+                       'PrefixSearchBackend',
+                       array( $namespaces, $search, $limit, &$srchres, $offset )
+               ) ) {
                        return $this->titles( $this->defaultSearchBackend( $namespaces, $search, $limit, $offset ) );
                }
                return $this->strings( $this->handleResultFromHook( $srchres, $namespaces, $search, $limit ) );
@@ -359,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',