Skip to content

Commit

Permalink
Strings::trim() trims ZWSP char (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyMuffin committed Oct 30, 2023
1 parent 79f6cb3 commit 4b7b01e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Utils/Strings.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Strings
{
use Nette\StaticClass;

public const TrimCharacters = " \t\n\r\0\x0B\u{A0}";
public const TrimCharacters = " \t\n\r\0\x0B\u{A0}\u{200B}";

/** @deprecated use Strings::TrimCharacters */
public const TRIM_CHARACTERS = self::TrimCharacters;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Strings.trim().phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Assert::same('x', Strings::trim(" \t\n\r\x00\x0B\u{A0}x"));
Assert::same('a b', Strings::trim(' a b '));
Assert::same(' a b ', Strings::trim(' a b ', ''));
Assert::same('e', Strings::trim("\u{158}e-", "\u{158}-")); // Ře-
Assert::same('foo', Strings::trim("​foo")); // Contains \u{200B} - `ZWSPfoo`

Assert::exception(
fn() => Strings::trim("\xC2x\xA0"),
Expand Down

0 comments on commit 4b7b01e

Please sign in to comment.