mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 19:59:11 +00:00
add some UTF-8 validation
This commit is contained in:
@@ -57,6 +57,7 @@ use function is_readable;
|
||||
use function is_string;
|
||||
use function json_decode;
|
||||
use function json_last_error_msg;
|
||||
use function mb_check_encoding;
|
||||
use function ob_end_clean;
|
||||
use function ob_get_contents;
|
||||
use function ob_start;
|
||||
@@ -559,4 +560,10 @@ class Utils{
|
||||
unlink($dir);
|
||||
}
|
||||
}
|
||||
|
||||
public static function checkUTF8(string $string) : void{
|
||||
if(!mb_check_encoding($string, 'UTF-8')){
|
||||
throw new \InvalidArgumentException("Text must be valid UTF-8");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user