From 67e6306a0edb75840a4ce3d2c604a748983980b0 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 31 Aug 2004 02:26:55 +0000 Subject: [PATCH] Avoid numeric and boolean interpretation of "0" in self-link check and Go searching. Fix for bug 174: 0 as an article name behaves strangely (numerical comparison in article-ids). http://bugzilla.wikipedia.org/show_bug.cgi?id=174 --- includes/Parser.php | 4 ++-- index.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index 4a1bc0c70c..4f3dae67c2 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1104,8 +1104,8 @@ class Parser } } - if( ( $nt->getPrefixedText() == $this->mTitle->getPrefixedText() ) && - ( strpos( $link, '#' ) == FALSE ) ) { + if( ( $nt->getPrefixedText() === $this->mTitle->getPrefixedText() ) && + ( strpos( $link, '#' ) === FALSE ) ) { # Self-links are handled specially; generally de-link and change to bold. $s .= $prefix . $sk->makeSelfLinkObj( $nt, $text, '', $trail ); continue; diff --git a/index.php b/index.php index 9f8fa52ca1..045b0a114c 100644 --- a/index.php +++ b/index.php @@ -61,7 +61,8 @@ if ( !is_null( $wgTitle ) && !$wgTitle->userCanRead() ) { } wfProfileIn( "main-action" ); -if( $search = $wgRequest->getText( 'search' ) ) { +$search = $wgRequest->getText( 'search' ); +if( !is_null( $search ) && $search !== '' ) { require_once( 'SearchEngine.php' ); $wgTitle = Title::makeTitle( NS_SPECIAL, "Search" ); $searchEngine = new SearchEngine( $search ); -- 2.20.1