X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2FStringUtils.php;h=7915ccf19146421dc8dda9cd89d5c0b4742bc842;hb=633252c3e9a3e462282c94ccad71f808175394b2;hp=cffb5a39457a2b4f09a35e8aa1e8ed9716c13622;hpb=5b1dcdc344f5d251120a161637bcb89e01b0f6a4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/StringUtils.php b/includes/libs/StringUtils.php index cffb5a3945..7915ccf191 100644 --- a/includes/libs/StringUtils.php +++ b/includes/libs/StringUtils.php @@ -39,19 +39,7 @@ class StringUtils { * @return bool Whether the given $value is a valid UTF-8 encoded string */ static function isUtf8( $value ) { - $value = (string)$value; - - // HHVM 3.4 and older come with an outdated version of libmbfl that - // incorrectly allows values above U+10FFFF, so we have to check - // for them separately. (This issue also exists in PHP 5.3 and - // older, which are no longer supported.) - static $newPHP; - if ( $newPHP === null ) { - $newPHP = !mb_check_encoding( "\xf4\x90\x80\x80", 'UTF-8' ); - } - - return mb_check_encoding( $value, 'UTF-8' ) && - ( $newPHP || preg_match( "/\xf4[\x90-\xbf]|[\xf5-\xff]/S", $value ) === 0 ); + return mb_check_encoding( (string)$value, 'UTF-8' ); } /** @@ -276,7 +264,7 @@ class StringUtils { // Replace instances of the separator inside HTML-like tags with the placeholder $replacer = new DoubleReplacer( $separator, $placeholder ); - $cleaned = StringUtils::delimiterReplaceCallback( '<', '>', $replacer->cb(), $text ); + $cleaned = self::delimiterReplaceCallback( '<', '>', $replacer->cb(), $text ); // Explode, then put the replaced separators back in $items = explode( $separator, $cleaned ); @@ -303,7 +291,7 @@ class StringUtils { // Replace instances of the separator inside HTML-like tags with the placeholder $replacer = new DoubleReplacer( $search, $placeholder ); - $cleaned = StringUtils::delimiterReplaceCallback( '<', '>', $replacer->cb(), $text ); + $cleaned = self::delimiterReplaceCallback( '<', '>', $replacer->cb(), $text ); // Explode, then put the replaced separators back in $cleaned = str_replace( $search, $replace, $cleaned );