Merge "Don't use isset() to check whether an existing variable is null"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 12 Mar 2013 15:08:56 +0000 (15:08 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 12 Mar 2013 15:08:56 +0000 (15:08 +0000)
includes/ImagePage.php
includes/Import.php
includes/Linker.php
includes/MimeMagic.php

index 55a8cc5..11e876f 100644 (file)
@@ -108,7 +108,7 @@ class ImagePage extends Article {
                $diff = $request->getVal( 'diff' );
                $diffOnly = $request->getBool( 'diffonly', $this->getContext()->getUser()->getOption( 'diffonly' ) );
 
-               if ( $this->getTitle()->getNamespace() != NS_FILE || ( isset( $diff ) && $diffOnly ) ) {
+               if ( $this->getTitle()->getNamespace() != NS_FILE || ( $diff !== null && $diffOnly ) ) {
                        parent::view();
                        return;
                }
@@ -116,7 +116,7 @@ class ImagePage extends Article {
                $this->loadFile();
 
                if ( $this->getTitle()->getNamespace() == NS_FILE && $this->mPage->getFile()->getRedirected() ) {
-                       if ( $this->getTitle()->getDBkey() == $this->mPage->getFile()->getName() || isset( $diff ) ) {
+                       if ( $this->getTitle()->getDBkey() == $this->mPage->getFile()->getName() || $diff !== null ) {
                                // mTitle is the same as the redirect target so ask Article
                                // to perform the redirect for us.
                                $request->setVal( 'diffonly', 'true' );
index b5411fc..67af3d7 100644 (file)
@@ -1646,7 +1646,7 @@ class ImportStreamSource {
        static function newFromUpload( $fieldname = "xmlimport" ) {
                $upload =& $_FILES[$fieldname];
 
-               if( !isset( $upload ) || !$upload['name'] ) {
+               if( $upload === null || !$upload['name'] ) {
                        return Status::newFatal( 'importnofile' );
                }
                if( !empty( $upload['error'] ) ) {
index dc73ea2..8003ca3 100644 (file)
@@ -616,7 +616,7 @@ class Linker {
 
                        if ( isset( $fp['thumbnail'] ) || isset( $fp['framed'] ) || isset( $fp['frameless'] ) || !$hp['width'] ) {
                                global $wgThumbLimits, $wgThumbUpright;
-                               if ( !isset( $widthOption ) || !isset( $wgThumbLimits[$widthOption] ) ) {
+                               if ( $widthOption === null || !isset( $wgThumbLimits[$widthOption] ) ) {
                                        $widthOption = User::getDefaultOption( 'thumbsize' );
                                }
 
index 70feafd..68b6f6a 100644 (file)
@@ -346,7 +346,7 @@ class MimeMagic {
         * @return MimeMagic
         */
        public static function &singleton() {
-               if ( !isset( self::$instance ) ) {
+               if ( self::$instance === null ) {
                        self::$instance = new MimeMagic;
                }
                return self::$instance;