Allow titles with falsy title text in suggestions
authorErik Bernhardson <ebernhardson@wikimedia.org>
Thu, 24 Mar 2016 23:35:54 +0000 (16:35 -0700)
committerErik Bernhardson <ebernhardson@wikimedia.org>
Thu, 24 Mar 2016 23:35:56 +0000 (16:35 -0700)
A valid title, such as 0, would end up being ignored in this clause and
not providing a title. Make the empty string check stricter to allow
these titles through.

Change-Id: I938a7dfe294e979c19f720eadb6f96282b1c4588

includes/search/SearchSuggestion.php

index cd9062b..80a437b 100644 (file)
@@ -84,7 +84,7 @@ class SearchSuggestion {
         */
        public function setText( $text, $setTitle = true ) {
                $this->text = $text;
-               if ( $setTitle && $text ) {
+               if ( $setTitle && $text !== '' && $text !== null ) {
                        $this->setSuggestedTitle( Title::makeTitle( 0, $text ) );
                }
        }