Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
May 7, 2025

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented May 6, 2025

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #60352
License MIT

this update was forgotten when adding the html5-allow-no-tld e-mail validation mode in #47872

Comment on lines 1069 to 1070
->enumNode('email_validation_mode')->values(['html5', 'loose', 'strict'])->end()
->enumNode('email_validation_mode')->values(Email::VALIDATION_MODES)->end()
Copy link
Member

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.

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:

if (!isset($config['email_validation_mode'])) {
$config['email_validation_mode'] = 'loose';
}

Is there a bug here that makes this config required?

Copy link
Member Author

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.

Copy link
Member Author

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)

@fabpot
Copy link
Member

fabpot commented May 7, 2025

Thank you @xabbuh.

@fabpot fabpot merged commit 233f975 into symfony:6.4 May 7, 2025
10 of 11 checks passed
@xabbuh xabbuh deleted the issue-60352 branch May 7, 2025 06:45
@@ -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()
Copy link
Member

@Kocal Kocal May 7, 2025

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #60373

fabpot added a commit that referenced this pull request May 8, 2025
… 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
xabbuh added a commit that referenced this pull request May 8, 2025
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
@fabpot fabpot mentioned this pull request May 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants