Don't use isset() to check for null
authorAlexandre Emsenhuber <mediawiki@emsenhuber.ch>
Sat, 24 May 2014 05:45:33 +0000 (07:45 +0200)
committerAlexandre Emsenhuber <mediawiki@emsenhuber.ch>
Sat, 24 May 2014 05:45:33 +0000 (07:45 +0200)
Fixes in includes/specials

Change-Id: I6c382aeaa92372bc11220694c479006e3c658362

includes/specials/SpecialAllpages.php
includes/specials/SpecialChangePassword.php
includes/specials/SpecialFileDuplicateSearch.php
includes/specials/SpecialLinkSearch.php
includes/specials/SpecialPrefixindex.php
includes/specials/SpecialWhatlinkshere.php

index ad92298..0490d82 100644 (file)
@@ -296,7 +296,7 @@ class SpecialAllpages extends IncludableSpecialPage {
                $bottomLinks = array();
 
                # Do we put a previous link ?
-               if ( isset( $prevTitle ) && $pt = $prevTitle->getText() ) {
+               if ( $prevTitle && $pt = $prevTitle->getText() ) {
                        $query = array( 'from' => $prevTitle->getText() );
 
                        if ( $namespace ) {
index f4ce882..dcd2443 100644 (file)
@@ -83,7 +83,7 @@ class SpecialChangePassword extends FormSpecialPage {
                $request = $this->getRequest();
 
                $oldpassMsg = $this->mOldPassMsg;
-               if ( !isset( $oldpassMsg ) ) {
+               if ( $oldpassMsg === null ) {
                        $oldpassMsg = $user->isLoggedIn() ? 'oldpassword' : 'resetpass-temp-password';
                }
 
index 9cf5a73..b6c9d55 100644 (file)
@@ -101,7 +101,7 @@ class FileDuplicateSearchPage extends QueryPage {
                $this->setHeaders();
                $this->outputHeader();
 
-               $this->filename = isset( $par ) ? $par : $this->getRequest()->getText( 'filename' );
+               $this->filename = $par !== null ? $par : $this->getRequest()->getText( 'filename' );
                $this->file = null;
                $this->hash = '';
                $title = Title::newFromText( $this->filename, NS_FILE );
index c44e8e1..b88e196 100644 (file)
@@ -209,7 +209,7 @@ class LinkSearchPage extends QueryPage {
                global $wgMiserMode;
                $params = array();
                $params['target'] = $this->mProt . $this->mQuery;
-               if ( isset( $this->mNs ) && !$wgMiserMode ) {
+               if ( $this->mNs !== null && !$wgMiserMode ) {
                        $params['namespace'] = $this->mNs;
                }
 
@@ -244,7 +244,7 @@ class LinkSearchPage extends QueryPage {
                        'options' => array( 'USE INDEX' => $clause )
                );
 
-               if ( isset( $this->mNs ) && !$wgMiserMode ) {
+               if ( $this->mNs !== null && !$wgMiserMode ) {
                        $retval['conds']['page_namespace'] = $this->mNs;
                }
 
index b6b60d4..34e803d 100644 (file)
@@ -76,7 +76,7 @@ class SpecialPrefixindex extends SpecialAllpages {
                );
 
                $showme = '';
-               if ( isset( $par ) ) {
+               if ( $par !== null ) {
                        $showme = $par;
                } elseif ( $prefix != '' ) {
                        $showme = $prefix;
@@ -167,6 +167,7 @@ class SpecialPrefixindex extends SpecialAllpages {
                $fromList = $this->getNamespaceKeyAndText( $namespace, $from );
                $prefixList = $this->getNamespaceKeyAndText( $namespace, $prefix );
                $namespaces = $wgContLang->getNamespaces();
+               $res = null;
 
                if ( !$prefixList || !$fromList ) {
                        $out = $this->msg( 'allpagesbadtitle' )->parseAsBlock();
@@ -261,9 +262,7 @@ class SpecialPrefixindex extends SpecialAllpages {
                                '</td>
                                <td id="mw-prefixindex-nav-form" class="mw-prefixindex-nav">';
 
-                       if ( isset( $res ) && $res && ( $n == $this->maxPerPage ) &&
-                               ( $s = $res->fetchObject() )
-                       ) {
+                       if ( $res && ( $n == $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
                                $query = array(
                                        'from' => $s->page_title,
                                        'prefix' => $prefix,
index 6488810..d980f79 100644 (file)
@@ -64,7 +64,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                $opts->validateIntBounds( 'limit', 0, 5000 );
 
                // Give precedence to subpage syntax
-               if ( isset( $par ) ) {
+               if ( $par !== null ) {
                        $opts->setValue( 'target', $par );
                }