Figure out how email contraint bound to egulias email validator

Created on 4 September 2022, over 2 years ago
Updated 29 June 2024, 6 months ago

Problem/Motivation

Follow-up to #3307736-4: EmailValidator defaults to 'loose' mode which is deprecated in Symfony 6.2 β†’

SF using egulias for email validation in strict mode, see \Symfony\Component\Validator\Constraints\EmailValidator::validate()

Steps to reproduce

I think we need a follow-up to figure out why the constraint and validator can go out of sync and maybe also to reconcile the email validator service which uses egulias directly with the Symfony validator.

Proposed resolution

Decide how to re-use email validator from SF and clean-up \Drupal\Component\Utility\EmailValidator::isValid() component

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated 1 day ago

Created by

πŸ‡«πŸ‡·France andypost

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany tstoeckler Essen, Germany

    So as far as I can tell the following is true:

    1. We have an email.validator service that uses egulias' one but does not perform strict validation (it uses RFCValidation())
    2. Email form elements use this service
    3. Email fields do not use the core service but the Symfony constraint which also uses egulias' validator but does perform strict validation (it uses NoRFCWarningsValidation())

    The discrepancy between form elements and fields is already very unfortunate in my opinion in it's own right. It get's worse, though, because of the fact that on site install the site email (form element) is used as the user 1 email (field). Thus, you can currently install Drupal using foo@localhost as a site (+ user 1) email, but that leaves user 1 in an invalid state. In particular, you cannot submit the user 1 profile form (without changing the email to something else).

    As far as I can tell, the decision to prefer strict validation in core has already been made by #3307736: EmailValidator defaults to 'loose' mode which is deprecated in Symfony 6.2 β†’ so I think the solution would be to just make the email.validator service use strict validation, as well, but holding off on the title and issue summary and the re-classifying as a bug until some confirmation on the proposed the resolution.

  • πŸ‡©πŸ‡ͺGermany tstoeckler Essen, Germany
Production build 0.71.5 2024