[FrameworkBundle] Ensure Email class exists before using it#60373
[FrameworkBundle] Ensure Email class exists before using it#60373fabpot merged 1 commit intosymfony:6.4from
Email class exists before using it#60373Conversation
|
Hey! Thanks for your PR. You are targeting branch "6.4" but it seems your PR description refers to branch "6.4,". Cheers! Carsonbot |
| ->end() | ||
| ->scalarNode('translation_domain')->defaultValue('validators')->end() | ||
| ->enumNode('email_validation_mode')->values(Email::VALIDATION_MODES + ['loose'])->end() | ||
| ->enumNode('email_validation_mode')->values((class_exists(Email::class) ? Email::VALIDATION_MODES : ['html5-allow-no-tld', 'html5', 'strict']) + ['loose'])->end() |
There was a problem hiding this comment.
Since I believe email_validation_mode won't be used if symfony/mailer is not installed, maybe we can just keep it empty:
| ->enumNode('email_validation_mode')->values((class_exists(Email::class) ? Email::VALIDATION_MODES : ['html5-allow-no-tld', 'html5', 'strict']) + ['loose'])->end() | |
| ->enumNode('email_validation_mode')->values(class_exists(Email::class) ? Email::VALIDATION_MODES + ['loose'] : [])->end() |
There was a problem hiding this comment.
I would keep it the way you changed it here for the same reason we kept loose in #60365, let's better be defensive here as we don't know how people configured their applications
There was a problem hiding this comment.
After upgrading to Symfony 7.2.7 we observe this error:
In EnumNode.php line 82:
The value "loose" is not allowed for path "framework.validation.email_valid
ation_mode". Permissible values: "html5-allow-no-tld", "html5", "strict"
Error: Process completed with exit code 1.
Our configuration is:
framework:
...
validation:
...
email_validation_mode: looseFrom bin/console config:dump-reference framework we observe:
framework:
...
validation:
...
email_validation_mode: html5 # One of "html5-allow-no-tld"; "html5"; "strict"
I think this should use array_merge() instead of the + operator to correctly merge the arrays.
There was a problem hiding this comment.
can you please create a new issue or a pull request? Thanks
There was a problem hiding this comment.
|
Thank you @Kocal. |
… mode (rhel-eo)
This PR was squashed before being merged into the 6.4 branch.
Discussion
----------
[FrameworkBundle] Fix allow `loose` as an email validation mode
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| License | MIT
After upgrading to Symfony 7.2.7 we observe this error:
```
In EnumNode.php line 82:
The value "loose" is not allowed for path "framework.validation.email_valid
ation_mode". Permissible values: "html5-allow-no-tld", "html5", "strict"
```
Our configuration is:
```yaml
framework:
...
validation:
...
email_validation_mode: loose
```
From `bin/console config:dump-reference framework` we observe:
```
framework:
...
validation:
...
email_validation_mode: html5 # One of "html5-allow-no-tld"; "html5"; "strict"
```
After this change, the above error no longer occurs and expected allowed values are observed:
```
$ php bin/console config:dump-reference framework
framework:
...
validation:
...
email_validation_mode: ~ # One of "html5-allow-no-tld"; "html5"; "strict"; "loose"
```
See #60373 and #60365 where the previous code was introduced.
Commits
-------
23b9c4f [FrameworkBundle] Fix allow `loose` as an email validation mode
I think the dev-tests suite from Symfony UX broke after #60365, see: