Skip to content

Commit 34267af

Browse files
committed
bug #24821 symfony/form auto-enables symfony/validator, even when not present (weaverryan)
This PR was merged into the 3.4 branch. Discussion ---------- symfony/form auto-enables symfony/validator, even when not present | Q | A | ------------- | --- | Branch? | 3.4 or master / 2.7, 2.8 or 3.3 <!-- see comment below --> | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | not needed In #24303, we allowed form to be used without the validator component. But, there is a small problem with the logic: the validation system is set to enabled, even if it is not present. If you install form but NOT validator, you see the error: > Validation support cannot be enabled as the Validator component is not installed. Assuming the form system really is usable without validation, this should be an easy merge. Commits ------- 03c0254296 Only enabling validation if it is present
2 parents a9144aa + 14729e3 commit 34267af

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,10 @@ public function load(array $configs, ContainerBuilder $container)
241241
if ($this->isConfigEnabled($container, $config['form'])) {
242242
$this->formConfigEnabled = true;
243243
$this->registerFormConfiguration($config, $container, $loader);
244-
$config['validation']['enabled'] = true;
245244

246-
if (!class_exists('Symfony\Component\Validator\Validation')) {
245+
if (class_exists('Symfony\Component\Validator\Validation')) {
246+
$config['validation']['enabled'] = true;
247+
} else {
247248
$container->setParameter('validator.translation_domain', 'validators');
248249

249250
$container->removeDefinition('form.type_extension.form.validator');

0 commit comments

Comments
 (0)