IAlex has uploaded a new change for review.
https://gerrit.wikimedia.org/r/53038
Change subject: Don't use isset() to check whether an existing variable is null
......................................................................
Don't use isset() to check whether an existing variable is null
Change-Id: Ie63f060fb7928fd51a8ad71293955f923f6a18c3
---
M includes/ImagePage.php
M includes/Import.php
M includes/Linker.php
M includes/MimeMagic.php
4 files changed, 5 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/38/53038/1
diff --git a/includes/ImagePage.php b/includes/ImagePage.php
index 998d607..086b4dd 100644
--- a/includes/ImagePage.php
+++ b/includes/ImagePage.php
@@ -108,7 +108,7 @@
$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 @@
$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 15e6620..78f77a1 100644
--- a/includes/Import.php
+++ b/includes/Import.php
@@ -1646,7 +1646,7 @@
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 a9bf934..d5b3b2f 100644
--- a/includes/Linker.php
+++ b/includes/Linker.php
@@ -616,7 +616,7 @@
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 226b0b1..72bb4c6 100644
--- a/includes/MimeMagic.php
+++ b/includes/MimeMagic.php
@@ -346,7 +346,7 @@
* @return MimeMagic
*/
public static function &singleton() {
- if ( !isset( self::$instance ) ) {
+ if ( self::$instance === null ) {
self::$instance = new MimeMagic;
}
return self::$instance;
--
To view, visit https://gerrit.wikimedia.org/r/53038
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie63f060fb7928fd51a8ad71293955f923f6a18c3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: IAlex <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits