bug #11283 [SecurityBundle] Remove Expression Language services when the component is unavailable (thewilkybarkid)

This PR was merged into the 2.4 branch.

Discussion
----------

[SecurityBundle] Remove Expression Language services when the component is unavailable

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

The Expression Language isn't a dependency of the SecurityBundle, but ExpressionVoter is still added if it isn't installed, leading to a class not found fatal error. This removes the services (alternatively the services could be moved to a different file and added if it is installed).

Commits
-------

557a82a Remove Expression Language services when the component is unavailable
This commit is contained in:
Fabien Potencier 2014-07-04 08:17:48 +02:00
commit ce29e0aa8c

View File

@ -66,6 +66,11 @@ class SecurityExtension extends Extension
$loader->load('templating_twig.xml');
$loader->load('collectors.xml');
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
$container->removeDefinition('security.expression_language');
$container->removeDefinition('security.access.expression_voter');
}
// set some global scalars
$container->setParameter('security.access.denied_url', $config['access_denied_url']);
$container->setParameter('security.authentication.manager.erase_credentials', $config['erase_credentials']);