check for the Validator if forms are enabled
When the Form component is enabled, the container extension class automatically enables the Validator component which therefore has to be enabled. The container extension now throws an exception when forms are enabled, but the Validator component is not present.
This commit is contained in:
parent
1ec88bed2c
commit
ed41da1c9c
@ -14,6 +14,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\DefinitionDecorator;
|
||||
use Symfony\Component\DependencyInjection\Exception\LogicException;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
@ -103,6 +104,10 @@ class FrameworkExtension extends Extension
|
||||
$this->registerFormConfiguration($config, $container, $loader);
|
||||
$config['validation']['enabled'] = true;
|
||||
|
||||
if (!class_exists('Symfony\Component\Validator\Validator')) {
|
||||
throw new LogicException('The Validator component is required to use the Form component.');
|
||||
}
|
||||
|
||||
if ($this->isConfigEnabled($container, $config['form']['csrf_protection'])) {
|
||||
$config['csrf_protection']['enabled'] = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user