From c6a889acc41a119290fc68d5263f92075c9d100c Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sun, 10 Mar 2013 16:23:46 +0100 Subject: [PATCH] Don't use isset() to check whether an existing variable is null Change-Id: Ie63f060fb7928fd51a8ad71293955f923f6a18c3 --- includes/ImagePage.php | 4 ++-- includes/Import.php | 2 +- includes/Linker.php | 2 +- includes/MimeMagic.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 998d60745d..086b4dd84d 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -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' ); diff --git a/includes/Import.php b/includes/Import.php index 15e6620556..78f77a1f05 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -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'] ) ) { diff --git a/includes/Linker.php b/includes/Linker.php index a9bf93428c..d5b3b2f9d6 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -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' ); } diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index 226b0b186c..72bb4c6f56 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -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; -- 2.20.1