Skip to content

Commit f8cca42

Browse files
bug #60705 [FrameworkBundle] Fix allow loose as an email validation mode (rhel-eo)
This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [FrameworkBundle] Fix allow `loose` as an email validation mode | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | License | MIT After upgrading to Symfony 7.2.7 we observe this error: ``` In EnumNode.php line 82: The value "loose" is not allowed for path "framework.validation.email_valid ation_mode". Permissible values: "html5-allow-no-tld", "html5", "strict" ``` Our configuration is: ```yaml framework: ... validation: ... email_validation_mode: loose ``` From `bin/console config:dump-reference framework` we observe: ``` framework: ... validation: ... email_validation_mode: html5 # One of "html5-allow-no-tld"; "html5"; "strict" ``` After this change, the above error no longer occurs and expected allowed values are observed: ``` $ php bin/console config:dump-reference framework framework: ... validation: ... email_validation_mode: ~ # One of "html5-allow-no-tld"; "html5"; "strict"; "loose" ``` See #60373 and #60365 where the previous code was introduced. Commits ------- 23b9c4f [FrameworkBundle] Fix allow `loose` as an email validation mode
2 parents 656f786 + 23b9c4f commit f8cca42

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode, callable $e
10671067
->validate()->castToArray()->end()
10681068
->end()
10691069
->scalarNode('translation_domain')->defaultValue('validators')->end()
1070-
->enumNode('email_validation_mode')->values((class_exists(Email::class) ? Email::VALIDATION_MODES : ['html5-allow-no-tld', 'html5', 'strict']) + ['loose'])->end()
1070+
->enumNode('email_validation_mode')->values(array_merge(class_exists(Email::class) ? Email::VALIDATION_MODES : ['html5-allow-no-tld', 'html5', 'strict'], ['loose']))->end()
10711071
->arrayNode('mapping')
10721072
->addDefaultsIfNotSet()
10731073
->fixXmlConfig('path')

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,5 +272,6 @@ public static function emailValidationModeProvider()
272272
foreach (Email::VALIDATION_MODES as $mode) {
273273
yield [$mode];
274274
}
275+
yield ['loose'];
275276
}
276277
}

0 commit comments

Comments
 (0)