Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Mbstring/Mbstring.php
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ public static function mb_ltrim(string $string, ?string $characters = null, ?str

public static function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string
{
return self::mb_internal_trim('{[%s]+$}D', $string, $characters, $encoding, __FUNCTION__);
return self::mb_internal_trim('{[%s]+$}Du', $string, $characters, $encoding, __FUNCTION__);
}

private static function mb_internal_trim(string $regex, string $string, ?string $characters, ?string $encoding, string $function): string
Expand Down
2 changes: 2 additions & 0 deletions tests/Mbstring/MbstringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@ public static function mbLTrimProvider(): iterable
yield [' test ', ' test ', ''];

yield ['いああああ', 'あああああああああああああああああああああああああああああああああいああああ', 'あ'];
yield ['あいうえお ', ' あいうえお '];

yield ['漢字', "\u{FFFE}漢字", "\u{FFFE}\u{FEFF}"];
yield [' abcd ', ' abcd ', ''];
Expand All @@ -902,6 +903,7 @@ public static function mbRTrimProvider(): iterable
yield [' a', str_repeat(' ', 129).'a'];

yield ['あああああああああああああああああああああああああああああああああい', 'あああああああああああああああああああああああああああああああああいああああ', 'あ'];
yield [' あいうえお', ' あいうえお '];

yield [' abcd ', ' abcd ', ''];

Expand Down
Loading