Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Validator] Change default mode of Assert\Email to "strict", for consistency with Mailer #41855

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
ThomasLandauer opened this issue Jun 25, 2021 · 7 comments · Fixed by #46518

Comments

@ThomasLandauer
Copy link
Contributor

Description
Since Symfony Mailer is using egulias/email-validator to validate email addresses, I'm suggesting to make this the default for Assert\Email.

Why? When using a framework to let users enter their email address, my minimum expectation would be that the very same framework is able to send an email there ;-) In other words: Symfony needs to stay consistent.

See #41850 for an example I encountered in production - but I'm sure there are better ones ;-)

@stof
Copy link
Member

stof commented Jun 25, 2021

Changing the default in the validator component would break things for projects that don't have egulias/email-validator as dependency.
However, there is already a config option to configure the default strictness of the email validation globally in the project (for cases where the mapping does not configure it explicitly). A way to solve that would be to have a smart default in FrameworkBundle for that config based on egulias/email-validator being installed or no.

ThomasLandauer added a commit to ThomasLandauer/symfony-docs that referenced this issue Jun 26, 2021
Info is taken from symfony/symfony#41855 (comment)

Maybe you should create an include to use the same wording for here and https://symfony.com/doc/4.4/reference/constraints/Email.html#mode
javiereguiluz added a commit to symfony/symfony-docs that referenced this issue Jul 7, 2021
This PR was merged into the 4.4 branch.

Discussion
----------

Minor change at email_validation_mode

Info is taken from symfony/symfony#41855 (comment)

Maybe you should create an include to use the same wording for here and https://symfony.com/doc/4.4/reference/constraints/Email.html#mode
(But please merge #15467 first)

Commits
-------

cde5af7 Minor change at email_validation_mode
ThomasLandauer added a commit to ThomasLandauer/symfony-docs that referenced this issue Sep 25, 2021
And changing recommendation for html5; see symfony/symfony#41855
javiereguiluz added a commit to symfony/symfony-docs that referenced this issue Sep 25, 2021
This PR was merged into the 5.3 branch.

Discussion
----------

Adding missing link target

And changing recommendation for html5; see symfony/symfony#41855

Commits
-------

7653381 Adding missing link target
@ThomasLandauer
Copy link
Contributor Author

After some more thinking about it, I'm now suggesting:

@javiereguiluz
Copy link
Member

My proposal:

  • Remove loose mode
  • Make html5 mode the default one
  • Don't make egulias/email-validator a hard dependency

Why?

  • html5 is like loose done right and it doesn't require any dependency
  • It's OK to require egulias/email-validator when using the Mailer component (it's 100% related to it) but it's not OK doing the same in the Validator component (where using the Email constraint is 100% optional, so you may never actually use it)

@fabpot
Copy link
Member

fabpot commented Oct 14, 2021

I like your plan @javiereguiluz
Ideally, we would deprecate the loose mode in 5.4 to be able to remove it in 6.0

Who wants to create the PR on 5.4?

ThomasLandauer added a commit to ThomasLandauer/symfony that referenced this issue Oct 14, 2021
@carsonbot
Copy link

Thank you for this issue.
There has not been a lot of activity here for a while. Has this been resolved?

@carsonbot
Copy link

Hello? This issue is about to be closed if nobody replies.

@xabbuh
Copy link
Member

xabbuh commented May 31, 2022

see #46518

@fabpot fabpot closed this as completed Jun 2, 2022
fabpot added a commit that referenced this issue Jun 2, 2022
… (xabbuh)

This PR was merged into the 6.2 branch.

Discussion
----------

[Validator] deprecate the loose e-mail validation mode

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | no
| New feature?  | no
| Deprecations? | yes
| Tickets       | Fix #41855
| License       | MIT
| Doc PR        |

Commits
-------

2243d11 deprecate the loose e-mail validation mode
bdsl added a commit to thebiggive/identity that referenced this issue Jan 16, 2024
…password reset token

We've updated to a new version of Symfony's validator and it wants us to
choose this new validation mode as a future version is going to take the
old mode away.

For details of change see ticket at Symfony:
symfony/symfony#41855
bdsl added a commit to thebiggive/identity that referenced this issue Jan 16, 2024
…password reset token

We've updated to a new version of Symfony's validator and it wants us to
choose this new validation mode as a future version is going to take the
old mode away.

For details of change see ticket at Symfony:
symfony/symfony#41855

And details of the html5 validtion mode when it was introduced:
https://symfony.com/blog/new-in-symfony-4-1-html5-email-validation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants