Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ReferenceEscaperLexer. #733

Closed
wants to merge 2 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ public function __construct(LexerInterface $decoratedLexer)
*/
public function lex(string $value): array
{
$escapedValue = preg_replace('/(\\p{L})@/', '$1\\@', $value);

$escapedValue = preg_replace('/((\s|^)[^@]?(\p{L}|\p{N}|[+-_.])+?(\p{L}|\p{N}))@/', '$1\\@', $value);
return $this->lexer->lex($escapedValue);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,7 @@ public function provideValues()
yield 'string with a reference with members' => ['bar @foo baz'];

yield 'reference in a middle of a word' => ['email@example', 'email\\@example'];

yield 'email ending with a digit' => ['email1@example', 'email1\\@example'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given the issues we had, feels like we should add a few more tests with exotic emails (with non ASCII characters for example)

}
}