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

Skip to content

[FrameworkBundle] Ensure Email class exists before using it #60373

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 8, 2025

Conversation

Kocal
Copy link
Member

@Kocal Kocal commented May 7, 2025

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

I think the dev-tests suite from Symfony UX 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

@carsonbot
Copy link

Hey!

Thanks for your PR. You are targeting branch "6.4" but it seems your PR description refers to branch "6.4,".
Could you update the PR description or change target branch? This helps core maintainers a lot.

Cheers!

Carsonbot

@@ -1067,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(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()
Copy link
Member Author

@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.

Since I believe email_validation_mode won't be used if symfony/mailer is not installed, maybe we can just keep it empty:

Suggested change
->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()

Copy link
Member

Choose a reason for hiding this comment

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

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

@fabpot
Copy link
Member

fabpot commented May 8, 2025

Thank you @Kocal.

@fabpot fabpot merged commit 166b527 into symfony:6.4 May 8, 2025
10 of 11 checks passed
@Kocal Kocal deleted the fix-60365 branch May 8, 2025 12:02
@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