Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 233f975

Browse filesBrowse 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
Copy full SHA for 233f975

File tree

2 files changed

+30
-1
lines changed
Filter options

2 files changed

+30
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+2-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php
+28Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.