From 7bc836cc723aec221c733dd119e328c7b58d60bf Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 5 Oct 2015 23:04:03 +0200 Subject: [PATCH] compatibility with Security component split The FrameworkBundle in version 2.3 can be used with recent versions of the Security component. However, after the Security component has been split with Symfony 2.4, translations resources have been moved to the `symfony/security-core` package. Thus, the changed location must be taken into account. --- .../DependencyInjection/FrameworkExtension.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index c6801f56e2..1129dfe1f4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -553,7 +553,16 @@ class FrameworkExtension extends Extension if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) { $r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException'); - $dirs[] = dirname($r->getFilename()).'/../../Resources/translations'; + $legacyTranslationsDir = dirname($r->getFilename()).'/../../Resources/translations'; + + if (file_exists($legacyTranslationsDir)) { + // in Symfony 2.3, translations are located in the symfony/security package + $dirs[] = $legacyTranslationsDir; + } else { + // with Symfony 2.4, the Security component was split into several subpackages + // and the translations have been moved to the symfony/security-core package + $dirs[] = dirname($r->getFilename()).'/../Resources/translations'; + } } $overridePath = $container->getParameter('kernel.root_dir').'/Resources/%s/translations'; foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {