Skip to content

[Validator] UTF-8 email address validation #59756

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

Closed
ro0NL opened this issue Feb 11, 2025 · 5 comments
Closed

[Validator] UTF-8 email address validation #59756

ro0NL opened this issue Feb 11, 2025 · 5 comments

Comments

@ro0NL
Copy link
Contributor

ro0NL commented Feb 11, 2025

Symfony version(s) affected

7

Description

Hi,

We recently disabled the builtin Email constraint on a SF7 project, due to an utf8 email address which came from an external party. The failing request (422) lead to another issue on our side.

For a larger project im a bit more worried :)

How to reproduce

to me this is somewhat a BC break: https://3v4l.org/11W3S (respectively sf6 vs sf7)

Possible Solution

Im wondering if loose mode should be restored for "simple" backend (re-)validation. HTML5 validation by default is OK.

Additional Context

No response

@abdalmassih-publicplan
Copy link

I know this is already closed, but I reproduced the issue as we are using Symfony v6.4.10.

Using VALIDATION_MODE_HTML5 or VALIDATION_MODE_HTML5_ALLOW_NO_TLD email validation modes does not help. I can confirm as mentioned that only the deprecated VALIDATION_MODE_LOOSE works with umlauts in the email address.

Image

With VALIDATION_MODE_HTML5_ALLOW_NO_TLD:

Image

Image

Using the deprecated VALIDATION_MODE_LOOSE:

Image

Image

@ro0NL
Copy link
Contributor Author

ro0NL commented Apr 15, 2025

it mimics the browser

Image

but i think it should be possible to loosen it

@stof
Copy link
Member

stof commented Apr 15, 2025

The HTML5 mode should keep following the HTML spec IMO (otherwise, it would be confusing).

See whatwg/html#4562 for the issue about this in the HTML spec.

Please try it in strict mode. egulias/email-validator (which is used for the strict validator) claims to support RFC 6531, which defines the SMTP extension for internationalized emails (which allows non-ASCII characters in the email)

@abdalmassih-publicplan
Copy link

abdalmassih-publicplan commented Apr 15, 2025

The HTML5 mode should keep following the HTML spec IMO (otherwise, it would be confusing).

See whatwg/html#4562 for the issue about this in the HTML spec.

Please try it in strict mode. egulias/email-validator (which is the strict validator) claims to support RFC 6531, which defines the SMTP extension for internationalized emails (which allows non-ASCII characters in the email)

@stof That's correct. After adding the other validator (composer require egulias/email-validator), the strict mode (VALIDATION_MODE_STRICT) works. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants