Avoid numeric and boolean interpretation of "0" in self-link check and Go searching.
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 31 Aug 2004 02:26:55 +0000 (02:26 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 31 Aug 2004 02:26:55 +0000 (02:26 +0000)
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
index.php

index 4a1bc0c..4f3dae6 100644 (file)
@@ -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;
index 9f8fa52..045b0a1 100644 (file)
--- 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 );