Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Validator] Email validation false-positive due to relative host #28665

Copy link
Copy link
Closed
@vudaltsov

Description

@vudaltsov
Issue body actions

Symfony version(s) affected: any?

Description
As warned in the comment to checkdnsrr() docs, one should pass a fully qualified domain name to get correct results, i.e. symfony.com. instead of symfony.com

99.9% of the time users do not put a dot at the end of their email which leads to incorrect checks.

Possible Solution without breaking BC

  1. Add a config value framework.validation.make_host_absolute = null (like framework.validation.make_host_absolute). If not set explicitly to true or false a deprecation is shown: Not setting a value explicitly is deprecated. Will be true by default since 5.0.
  2. Add EmailValidator::__construct(..., ?bool $makeHostAbsolute = null) with same BC logic.
  3. Add @Email::?bool $makeHostAbsolute = null to be able to override validator's default value when needed.
  4. if ($makeHostAbsolute && '.' !== mb_substr($email, -1)) { $email .= '.'; }

Ready to work on the PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.