Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7bc836c

Browse files
committed
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.
1 parent 136722c commit 7bc836c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,16 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
553553
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
554554
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
555555

556-
$dirs[] = dirname($r->getFilename()).'/../../Resources/translations';
556+
$legacyTranslationsDir = dirname($r->getFilename()).'/../../Resources/translations';
557+
558+
if (file_exists($legacyTranslationsDir)) {
559+
// in Symfony 2.3, translations are located in the symfony/security package
560+
$dirs[] = $legacyTranslationsDir;
561+
} else {
562+
// with Symfony 2.4, the Security component was split into several subpackages
563+
// and the translations have been moved to the symfony/security-core package
564+
$dirs[] = dirname($r->getFilename()).'/../Resources/translations';
565+
}
557566
}
558567
$overridePath = $container->getParameter('kernel.root_dir').'/Resources/%s/translations';
559568
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {

0 commit comments

Comments
 (0)