8000 [Validator] #18156 In "strict" mode, email validator inaccurately cla… by natechicago · Pull Request #6429 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Validator] #18156 In "strict" mode, email validator inaccurately cla… #6429

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
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
[Validator] #18156 In "strict" mode, email validator inaccurately cla…
…ims certain valid emails are invalid
  • Loading branch information
natechicago committed Apr 4, 2016
commit e3c63ad83682b4f8794915bfd0bde00f7d76584b
15 changes: 12 additions & 3 deletions reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Configuration
* :ref:`cache <reference-validation-cache>`
* :ref:`enable_annotations <reference-validation-enable_annotations>`
* `translation_domain`_
* `email_profile`_
* `strict_email`_
* `annotations`_
* :ref:`cache <reference-annotations-cache>`
Expand Down Expand Up @@ -1334,14 +1335,22 @@ translation_domain
The translation domain that is used when translating validation constraint
error messages.

email_profile
.............

**type**: ``string`` **default**: ``basic``

If this option is specified, the :doc:`/reference/constraints/Email`
constraint validator will default to the specified email validation profile.
See the linked page for more information.

strict_email
............

**type**: ``Boolean`` **default**: ``false``

If this option is enabled, the `egulias/email-validator`_ library will be
used by the :doc:`/reference/constraints/Email` constraint validator. Otherwise,
the validator uses a simple regular expression to validate email addresses.
DEPRECATED. If this option is enabled, the :doc:`/reference/constraints/Email`
constraint validator will default to the strict 'rfc-no-warn' profile.

annotations
~~~~~~~~~~~
Expand Down
38 changes: 34 additions & 4 deletions reference/constraints/Email.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ cast to a string before being validated.
+----------------+---------------------------------------------------------------------+
| Applies to | :ref:`property or method <validation-property-target>` |
+----------------+---------------------------------------------------------------------+
| Options | - `strict`_ |
| Options | - `profile`_ |
| | - `strict`_ |
| | - `message`_ |
| | - `checkMX`_ |
| | - `checkHost`_ |
Expand Down Expand Up @@ -91,14 +92,41 @@ Basic Usage
Options
-------

.. versionadded:: 3.1
The ``profile`` option was added in Symfony 3.1

profile
~~~~~~~

**type**: ``string`` **default**: ``basic``

This option is used to specify exactly which type of email validation should
be performed. It can be set to one of the following values:

``basic``
Validation will occur against a simple regular expression.
``html5``
Validation will occur against the regular expression defined in
the `HTML5 spec`_.
``rfc``
The `egulias/email-validator`_ library will perform an RFC-compliant
validation in non-strict mode. If any warning messages regarding
unusual/deprecated email address features are raised during validation,
they will not prevent an otherwise-valid email from being marked as
invalid.
``rfc-no-warn``
The `egulias/email-validator`_ library will perform an RFC-compliant
validation in strict mode. If any warning messages regarding
unusual/deprecated email address features are raised during validation,
the email address will be considered invalid.

strict
~~~~~~

**type**: ``boolean`` **default**: ``false``

When false, the email will be validated against a simple regular expression.
If true, then the `egulias/email-validator`_ library is required to perform
an RFC compliant validation.
DEPRECATED. When true, the email validator will use the strict
'rfc-no-warn' profile.

message
~~~~~~~
Expand Down Expand Up @@ -127,3 +155,5 @@ of the given email.
.. include:: /reference/constraints/_payload-option.rst.inc

.. _egulias/email-validator: https://packagist.org/packages/egulias/email-validator

.. _HTML5 spec: https://www.w3.org/TR/html-markup/datatypes.html#form.data.emailaddress-def
0