Fix UploadBase::checkXMLEncodingMissmatch() on PHP 7.1+
[lhc/web/wiklou.git] / includes / installer / Installer.php
index 911e5d2..f5fd3f2 100644 (file)
@@ -811,7 +811,7 @@ abstract class Installer {
                // with utf8 support, but not unicode property support.
                // check that \p{Zs} (space separators) matches
                // U+3000 (Ideographic space)
-               $regexprop = preg_replace( '/\p{Zs}/u', '', "-\xE3\x80\x80-" );
+               $regexprop = preg_replace( '/\p{Zs}/u', '', "-\u{3000}-" );
                Wikimedia\restoreWarnings();
                if ( $regexd != '--' || $regexprop != '--' ) {
                        $this->showError( 'config-pcre-no-utf8' );
@@ -1107,29 +1107,6 @@ abstract class Installer {
                return true;
        }
 
-       /**
-        * Convert a hex string representing a Unicode code point to that code point.
-        * @param string $c
-        * @return string|false
-        */
-       protected function unicodeChar( $c ) {
-               $c = hexdec( $c );
-               if ( $c <= 0x7F ) {
-                       return chr( $c );
-               } elseif ( $c <= 0x7FF ) {
-                       return chr( 0xC0 | $c >> 6 ) . chr( 0x80 | $c & 0x3F );
-               } elseif ( $c <= 0xFFFF ) {
-                       return chr( 0xE0 | $c >> 12 ) . chr( 0x80 | $c >> 6 & 0x3F ) .
-                               chr( 0x80 | $c & 0x3F );
-               } elseif ( $c <= 0x10FFFF ) {
-                       return chr( 0xF0 | $c >> 18 ) . chr( 0x80 | $c >> 12 & 0x3F ) .
-                               chr( 0x80 | $c >> 6 & 0x3F ) .
-                               chr( 0x80 | $c & 0x3F );
-               } else {
-                       return false;
-               }
-       }
-
        /**
         * Check the libicu version
         */
@@ -1137,12 +1114,12 @@ abstract class Installer {
                /**
                 * This needs to be updated something that the latest libicu
                 * will properly normalize.  This normalization was found at
-                * http://www.unicode.org/versions/Unicode5.2.0/#Character_Additions
+                * https://www.unicode.org/versions/Unicode5.2.0/#Character_Additions
                 * Note that we use the hex representation to create the code
                 * points in order to avoid any Unicode-destroying during transit.
                 */
-               $not_normal_c = $this->unicodeChar( "FA6C" );
-               $normal_c = $this->unicodeChar( "242EE" );
+               $not_normal_c = "\u{FA6C}";
+               $normal_c = "\u{242EE}";
 
                $useNormalizer = 'php';
                $needsUpdate = false;
@@ -1203,7 +1180,7 @@ abstract class Installer {
                $scriptTypes = [
                        'php' => [
                                "<?php echo 'ex' . 'ec';",
-                               "#!/var/env php5\n<?php echo 'ex' . 'ec';",
+                               "#!/var/env php\n<?php echo 'ex' . 'ec';",
                        ],
                ];