Skip to content

Commit fd75cfe

Browse files
committed
bug #16133 compatibility with Security component split (xabbuh)
This PR was merged into the 2.3 branch. Discussion ---------- compatibility with Security component split | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | 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. Commits ------- 7bc836c compatibility with Security component split
2 parents 136722c + 7bc836c commit fd75cfe

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)