From: Max Semenik Date: Fri, 13 Apr 2018 20:02:50 +0000 (-0700) Subject: Remove old hacks in StringUtils::isUtf8() X-Git-Tag: 1.31.0-rc.0~79^2 X-Git-Url: http://git.cyclocoop.org//%27http:/jquery.khurshid.com/ifixpng.php/%27?a=commitdiff_plain;h=bab845ecfe5870e2225b90b99c8183f5b86335e9;p=lhc%2Fweb%2Fwiklou.git Remove old hacks in StringUtils::isUtf8() We don't support any of the affected PHP or HHVM versions. Change-Id: I22a9252e621b519147168fab3197662c30131e71 --- diff --git a/includes/libs/StringUtils.php b/includes/libs/StringUtils.php index 9638706dc2..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' ); } /**