-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] ensure that all supported e-mail validation modes can be configured #60365
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
Conversation
->enumNode('email_validation_mode')->values(['html5', 'loose', 'strict'])->end() | ||
->enumNode('email_validation_mode')->values(Email::VALIDATION_MODES)->end() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loose
is no longer allowed in the config, but this value is already rejected by the constraint class.
symfony/src/Symfony/Component/Validator/Constraints/Email.php
Lines 28 to 30 in ed0a235
public const VALIDATION_MODE_HTML5_ALLOW_NO_TLD = 'html5-allow-no-tld'; | |
public const VALIDATION_MODE_HTML5 = 'html5'; | |
public const VALIDATION_MODE_STRICT = 'strict'; |
But this value is still used by default:
symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Lines 1660 to 1662 in 6b4f603
if (!isset($config['email_validation_mode'])) { | |
$config['email_validation_mode'] = 'loose'; | |
} |
Is there a bug here that makes this config required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This depends on the Symfony version you are browsing. The loose
mode was deprecated in 6.2 that's why you don't see it anymore in the 7.3
branch. And yes, I think being able to still configure it through the semantic configuration also is a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but we should probably indeed make sure that applications still using loose
don't break with the next patch release (as long as you don't use the Email
constraint that's probably not a real issue today)
Thank you @xabbuh. |
@@ -1066,7 +1067,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode, callable $e | |||
->validate()->castToArray()->end() | |||
->end() | |||
->scalarNode('translation_domain')->defaultValue('validators')->end() | |||
->enumNode('email_validation_mode')->values(['html5', 'loose', 'strict'])->end() | |||
->enumNode('email_validation_mode')->values(Email::VALIDATION_MODES + ['loose'])->end() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we must check if class Email
exists before using it, it broke our dev-tests suite on Symfony UX https://github.com/symfony/ux/actions/runs/14882498252/job/41793658394?pr=2714
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #60373
… it (Kocal) This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle] Ensure `Email` class exists before using it | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> I think the [dev-tests suite from Symfony UX](https://github.com/symfony/ux/actions/runs/14886649078/job/41808040295?pr=2711) broke after #60365, see: ``` 1) Symfony\UX\Icons\Tests\Integration\Command\ImportIconCommandTest::testCanImportIcon Error: Class "Symfony\Component\Validator\Constraints\Email" not found /home/runner/work/ux/ux/src/Icons/vendor/symfony/framework-bundle/DependencyInjection/Configuration.php:10[79](https://github.com/symfony/ux/actions/runs/14886649078/job/41808040295?pr=2711#step:8:80) /home/runner/work/ux/ux/src/Icons/vendor/symfony/framework-bundle/DependencyInjection/Configuration.php:163 /home/runner/work/ux/ux/src/Icons/vendor/symfony/config/Definition/Processor.php:46 /home/runner/work/ux/ux/src/Icons/vendor/symfony/dependency-injection/Extension/Extension.php:109 /home/runner/work/ux/ux/src/Icons/vendor/symfony/framework-bundle/DependencyInjection/FrameworkExtension.php:306 /home/runner/work/ux/ux/src/Icons/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php:[81](https://github.com/symfony/ux/actions/runs/14886649078/job/41808040295?pr=2711#step:8:82) /home/runner/work/ux/ux/src/Icons/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php:40 /home/runner/work/ux/ux/src/Icons/vendor/symfony/dependency-injection/Compiler/Compiler.php:73 /home/runner/work/ux/ux/src/Icons/vendor/symfony/dependency-injection/ContainerBuilder.php:813 /home/runner/work/ux/ux/src/Icons/vendor/symfony/http-kernel/Kernel.php:499 /home/runner/work/ux/ux/src/Icons/vendor/symfony/http-kernel/Kernel.php:744 /home/runner/work/ux/ux/src/Icons/vendor/symfony/http-kernel/Kernel.php:120 /home/runner/work/ux/ux/src/Icons/vendor/symfony/framework-bundle/Test/KernelTestCase.php:67 /home/runner/work/ux/ux/src/Icons/vendor/zenstruck/console-test/src/InteractsWithConsole.php:40 /home/runner/work/ux/ux/src/Icons/vendor/zenstruck/console-test/src/InteractsWithConsole.php:27 /home/runner/work/ux/ux/src/Icons/tests/Integration/Command/ImportIconCommandTest.php:46 ``` Commits ------- 680da0c [FrameworkBundle] Ensure `Email` class exists before using it
This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle] make data provider static | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT spotted in #58370 (I missed this in #60365) Commits ------- 04a46d3 make data provider static
this update was forgotten when adding the
html5-allow-no-tld
e-mail validation mode in #47872