}
}
$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 ) );
$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',