Skip to content

Commit d645617

Browse files
committed
fix: use mb_strlen in substrReplace for multibyte safety
refs: #57838
1 parent 8f982ce commit d645617

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Illuminate/Support/Str.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,7 @@ public static function substrCount($haystack, $needle, $offset = 0, $length = nu
17481748
public static function substrReplace($string, $replace, $offset = 0, $length = null)
17491749
{
17501750
if ($length === null) {
1751-
$length = strlen($string);
1751+
$length = mb_strlen($string);
17521752
}
17531753

17541754
return substr_replace($string, $replace, $offset, $length);

0 commit comments

Comments
 (0)