diff --git a/Helper/Helper.php b/Helper/Helper.php index e52e31515..f82dd286f 100644 --- a/Helper/Helper.php +++ b/Helper/Helper.php @@ -45,6 +45,8 @@ public function getHelperSet() */ public static function strlen(?string $string) { + $string = (string) $string; + if (false === $encoding = mb_detect_encoding($string, null, true)) { return \strlen($string); } @@ -59,6 +61,8 @@ public static function strlen(?string $string) */ public static function substr(string $string, int $from, int $length = null) { + $string = (string) $string; + if (false === $encoding = mb_detect_encoding($string, null, true)) { return substr($string, $from, $length); }