Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
[lhc/web/wiklou.git] / includes / upload / UploadBase.php
index ddb4bba..27c0ed7 100644 (file)
@@ -1425,9 +1425,9 @@ abstract class UploadBase {
                // detect the encoding in case is specifies an encoding not whitelisted in self::$safeXmlEncodings
                $attemptEncodings = [ 'UTF-16', 'UTF-16BE', 'UTF-32', 'UTF-32BE' ];
                foreach ( $attemptEncodings as $encoding ) {
-                       MediaWiki\suppressWarnings();
+                       Wikimedia\suppressWarnings();
                        $str = iconv( $encoding, 'UTF-8', $contents );
-                       MediaWiki\restoreWarnings();
+                       Wikimedia\restoreWarnings();
                        if ( $str != '' && preg_match( "!<\?xml\b(.*?)\?>!si", $str, $matches ) ) {
                                if ( preg_match( $encodingRegex, $matches[1], $encMatch )
                                        && !in_array( strtoupper( $encMatch[1] ), self::$safeXmlEncodings )
@@ -1864,8 +1864,7 @@ abstract class UploadBase {
                # look up scanner configuration
                $command = $wgAntivirusSetup[$wgAntivirus]['command'];
                $exitCodeMap = $wgAntivirusSetup[$wgAntivirus]['codemap'];
-               $msgPattern = isset( $wgAntivirusSetup[$wgAntivirus]['messagepattern'] ) ?
-                       $wgAntivirusSetup[$wgAntivirus]['messagepattern'] : null;
+               $msgPattern = $wgAntivirusSetup[$wgAntivirus]['messagepattern'] ?? null;
 
                if ( strpos( $command, "%f" ) === false ) {
                        # simple pattern: append file to scan