Skip to content

Commit 233f975

Browse files
committed
bug #60365 [FrameworkBundle] ensure that all supported e-mail validation modes can be configured (xabbuh)
This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle] ensure that all supported e-mail validation modes can be configured | 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 Commits ------- b8b3c37 ensure that all supported e-mail validation modes can be configured
2 parents 0d971eb + b8b3c37 commit 233f975

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
use Symfony\Component\Serializer\Serializer;
4646
use Symfony\Component\Translation\Translator;
4747
use Symfony\Component\Uid\Factory\UuidFactory;
48+
use Symfony\Component\Validator\Constraints\Email;
4849
use Symfony\Component\Validator\Validation;
4950
use Symfony\Component\Webhook\Controller\WebhookController;
5051
use Symfony\Component\WebLink\HttpHeaderSerializer;
@@ -1066,7 +1067,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode, callable $e
10661067
->validate()->castToArray()->end()
10671068
->end()
10681069
->scalarNode('translation_domain')->defaultValue('validators')->end()
1069-
->enumNode('email_validation_mode')->values(['html5', 'loose', 'strict'])->end()
1070+
->enumNode('email_validation_mode')->values(Email::VALIDATION_MODES + ['loose'])->end()
10701071
->arrayNode('mapping')
10711072
->addDefaultsIfNotSet()
10721073
->fixXmlConfig('path')

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\DependencyInjection\Exception\LogicException;
1818
use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException;
1919
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
20+
use Symfony\Component\Validator\Constraints\Email;
2021
use Symfony\Component\Workflow\Exception\InvalidDefinitionException;
2122

2223
class PhpFrameworkExtensionTest extends FrameworkExtensionTestCase
@@ -245,4 +246,31 @@ public function testRateLimiterLockFactory()
245246

246247
$container->getDefinition('limiter.without_lock')->getArgument(2);
247248
}
249+
250+
/**
251+
* @dataProvider emailValidationModeProvider
252+
*/
253+
public function testValidatorEmailValidationMode(string $mode)
254+
{
255+
$this->expectNotToPerformAssertions();
256+
257+
$this->createContainerFromClosure(function (ContainerBuilder $container) use ($mode) {
258+
$container->loadFromExtension('framework', [
259+
'annotations' => false,
260+
'http_method_override' => false,
261+
'handle_all_throwables' => true,
262+
'php_errors' => ['log' => true],
263+
'validation' => [
264+
'email_validation_mode' => $mode,
265+
],
266+
]);
267+
});
268+
}
269+
270+
public function emailValidationModeProvider()
271+
{
272+
foreach (Email::VALIDATION_MODES as $mode) {
273+
yield [$mode];
274+
}
275+
}
248276
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy