X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fupload%2FUploadBase.php;h=9e92e78772f524811f483c42eea04bf7608ab77c;hp=c42584cb1e03ff2a76ea9d754b2bee9e65df01e1;hb=a38af7ba26579bb3004f673e44d39710887763aa;hpb=b8e0ca16aa743581f5fac5cef8bed5ac2bf6e7cb diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index c42584cb1e..9e92e78772 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -947,8 +947,8 @@ abstract class UploadBase { */ list( $partname, $ext ) = $this->splitExtensions( $this->mFilteredName ); - if ( count( $ext ) ) { - $this->mFinalExtension = trim( $ext[count( $ext ) - 1] ); + if ( $ext !== [] ) { + $this->mFinalExtension = trim( end( $ext ) ); } else { $this->mFinalExtension = ''; @@ -1078,10 +1078,8 @@ abstract class UploadBase { $props = $this->mFileProps; $error = null; Hooks::run( 'UploadStashFile', [ $this, $user, $props, &$error ] ); - if ( $error ) { - if ( !is_array( $error ) ) { - $error = [ $error ]; - } + if ( $error && !is_array( $error ) ) { + $error = [ $error ]; } return $error; } @@ -1916,10 +1914,8 @@ abstract class UploadBase { $output = true; # if there's no output, return true } elseif ( $msgPattern ) { $groups = []; - if ( preg_match( $msgPattern, $output, $groups ) ) { - if ( $groups[1] ) { - $output = $groups[1]; - } + if ( preg_match( $msgPattern, $output, $groups ) && $groups[1] ) { + $output = $groups[1]; } }