Skip to content

Commit

Permalink
Merge branch '4.4' into 5.2
Browse files Browse the repository at this point in the history
* 4.4:
  Move github templates at the org level
  [Cache] Fix Redis TLS scheme `rediss` for Redis connection
  In calls to mb_ functions, silently transform arg into string
  • Loading branch information
nicolas-grekas committed Feb 23, 2021
2 parents 21e8ac3 + c98349b commit d6d0cc3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Helper/Helper.php
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit d6d0cc3

Please sign in to comment.