diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterTokenUsageTrackingPass.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterTokenUsageTrackingPass.php
index 94d5a18472..1cd90fe70a 100644
--- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterTokenUsageTrackingPass.php
+++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterTokenUsageTrackingPass.php
@@ -45,8 +45,12 @@ class RegisterTokenUsageTrackingPass implements CompilerPassInterface
$container->setAlias('security.token_storage', 'security.untracked_token_storage')->setPublic(true);
$container->getDefinition('security.untracked_token_storage')->addTag('kernel.reset', ['method' => 'reset']);
} elseif ($container->hasDefinition('security.context_listener')) {
- $container->getDefinition('security.context_listener')
- ->setArgument(6, [new Reference('security.token_storage'), 'enableUsageTracking']);
+ $tokenStorageClass = $container->getParameterBag()->resolveValue($container->findDefinition('security.token_storage')->getClass());
+
+ if (method_exists($tokenStorageClass, 'enableUsageTracking')) {
+ $container->getDefinition('security.context_listener')
+ ->setArgument(6, [new Reference('security.token_storage'), 'enableUsageTracking']);
+ }
}
}
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterTokenUsageTrackingPassTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterTokenUsageTrackingPassTest.php
new file mode 100644
index 0000000000..afdbf9afaf
--- /dev/null
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterTokenUsageTrackingPassTest.php
@@ -0,0 +1,89 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection\Compiler;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\RegisterTokenUsageTrackingPass;
+use Symfony\Component\DependencyInjection\Alias;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\DependencyInjection\Reference;
+use Symfony\Component\HttpFoundation\Session\Session;
+use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
+use Symfony\Component\Security\Core\Authentication\Token\Storage\UsageTrackingTokenStorage;
+use Symfony\Component\Security\Http\Firewall\ContextListener;
+
+class RegisterTokenUsageTrackingPassTest extends TestCase
+{
+ public function testTokenStorageIsUntrackedIfSessionIsMissing()
+ {
+ $container = new ContainerBuilder();
+ $container->register('security.untracked_token_storage', TokenStorage::class);
+
+ $compilerPass = new RegisterTokenUsageTrackingPass();
+ $compilerPass->process($container);
+
+ $this->assertTrue($container->hasAlias('security.token_storage'));
+ $this->assertEquals(new Alias('security.untracked_token_storage', true), $container->getAlias('security.token_storage'));
+ }
+
+ public function testContextListenerIsNotModifiedIfTokenStorageDoesNotSupportUsageTracking()
+ {
+ $container = new ContainerBuilder();
+
+ $container->setParameter('security.token_storage.class', TokenStorage::class);
+ $container->register('session', Session::class);
+ $container->register('security.context_listener', ContextListener::class)
+ ->setArguments([
+ new Reference('security.untracked_token_storage'),
+ [],
+ 'main',
+ new Reference('logger', ContainerInterface::NULL_ON_INVALID_REFERENCE),
+ new Reference('event_dispatcher', ContainerInterface::NULL_ON_INVALID_REFERENCE),
+ new Reference('security.authentication.trust_resolver'),
+ ]);
+ $container->register('security.token_storage', '%security.token_storage.class%');
+ $container->register('security.untracked_token_storage', TokenStorage::class);
+
+ $compilerPass = new RegisterTokenUsageTrackingPass();
+ $compilerPass->process($container);
+
+ $this->assertCount(6, $container->getDefinition('security.context_listener')->getArguments());
+ }
+
+ public function testContextListenerEnablesUsageTrackingIfSupportedByTokenStorage()
+ {
+ $container = new ContainerBuilder();
+
+ $container->setParameter('security.token_storage.class', UsageTrackingTokenStorage::class);
+ $container->register('session', Session::class);
+ $container->register('security.context_listener', ContextListener::class)
+ ->setArguments([
+ new Reference('security.untracked_token_storage'),
+ [],
+ 'main',
+ new Reference('logger', ContainerInterface::NULL_ON_INVALID_REFERENCE),
+ new Reference('event_dispatcher', ContainerInterface::NULL_ON_INVALID_REFERENCE),
+ new Reference('security.authentication.trust_resolver'),
+ ]);
+ $container->register('security.token_storage', '%security.token_storage.class%');
+ $container->register('security.untracked_token_storage', TokenStorage::class);
+
+ $compilerPass = new RegisterTokenUsageTrackingPass();
+ $compilerPass->process($container);
+
+ $contextListener = $container->getDefinition('security.context_listener');
+
+ $this->assertCount(7, $container->getDefinition('security.context_listener')->getArguments());
+ $this->assertEquals([new Reference('security.token_storage'), 'enableUsageTracking'], $contextListener->getArgument(6));
+ }
+}
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.af.xlf b/src/Symfony/Component/Form/Resources/translations/validators.af.xlf
new file mode 100644
index 0000000000..58cd939cf7
--- /dev/null
+++ b/src/Symfony/Component/Form/Resources/translations/validators.af.xlf
@@ -0,0 +1,139 @@
+
+
+
+
+
+ This form should not contain extra fields.
+ Hierdie vorm moet nie ekstra velde bevat nie.
+
+
+ The uploaded file was too large. Please try to upload a smaller file.
+ Die opgelaaide lêer was te groot. Probeer asseblief 'n kleiner lêer.
+
+
+ The CSRF token is invalid. Please try to resubmit the form.
+ Die CSRF-teken is ongeldig. Probeer asseblief om die vorm weer in te dien.
+
+
+ This value is not a valid HTML5 color.
+ Hierdie waarde is nie 'n geldige HTML5 kleur nie.
+
+
+ Please enter a valid birthdate.
+ Voer asseblief 'n geldige geboortedatum in.
+
+
+ The selected choice is invalid.
+ Die gekiesde opsie is nie geldig nie.
+
+
+ The collection is invalid.
+ Die versameling is nie geldig nie.
+
+
+ Please select a valid color.
+ Kies asseblief 'n geldige kleur.
+
+
+ Please select a valid country.
+ Kies asseblief 'n geldige land.
+
+
+ Please select a valid currency.
+ Kies asseblief 'n geldige geldeenheid.
+
+
+ Please choose a valid date interval.
+ Kies asseblief 'n geldige datum interval.
+
+
+ Please enter a valid date and time.
+ Voer asseblilef 'n geldige datum en tyd in.
+
+
+ Please enter a valid date.
+ Voer asseblief 'n geldige datum in.
+
+
+ Please select a valid file.
+ Kies asseblief 'n geldige lêer.
+
+
+ The hidden field is invalid.
+ Die versteekte veld is nie geldig nie.
+
+
+ Please enter an integer.
+ Voer asseblief 'n geldige heeltal in.
+
+
+ Please select a valid language.
+ Kies assblief 'n geldige taal.
+
+
+ Please select a valid locale.
+ Voer assebliefn 'n geldige locale in.
+
+
+ Please enter a valid money amount.
+ Voer asseblief 'n geldige bedrag in.
+
+
+ Please enter a number.
+ Voer asseblief 'n nommer in.
+
+
+ The password is invalid.
+ Die wagwoord is ongeldig.
+
+
+ Please enter a percentage value.
+ Voer asseblief 'n geldige persentasie waarde in.
+
+
+ The values do not match.
+ Die waardes is nie dieselfde nie.
+
+
+ Please enter a valid time.
+ Voer asseblief 'n geldige tyd in time.
+
+
+ Please select a valid timezone.
+ Kies asseblief 'n geldige tydsone.
+
+
+ Please enter a valid URL.
+ Voer asseblief 'n geldige URL in.
+
+
+ Please enter a valid search term.
+ Voer asseblief 'n geldige soek term in.
+
+
+ Please provide a valid phone number.
+ Verskaf asseblief 'n geldige telefoonnommer.
+
+
+ The checkbox has an invalid value.
+ Die blokkie het 'n ongeldige waarde.
+
+
+ Please enter a valid email address.
+ Voer asseblief 'n geldige e-pos adres in.
+
+
+ Please select a valid option.
+ Kies asseblief 'n geldige opsie.
+
+
+ Please select a valid range.
+ Kies asseblief 'n geldige reeks.
+
+
+ Please enter a valid week.
+ Voer assblief 'n geldige week in.
+
+
+
+
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.bs.xlf b/src/Symfony/Component/Form/Resources/translations/validators.bs.xlf
index cfe681e3b0..259b05f842 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.bs.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.bs.xlf
@@ -114,6 +114,26 @@
Please provide a valid phone number.Molim navedite ispravan broj telefona.
+
+ The checkbox has an invalid value.
+ Polje za potvrdu sadrži neispravnu vrijednost.
+
+
+ Please enter a valid email address.
+ Molim upišite ispravnu email adresu.
+
+
+ Please select a valid option.
+ Molim izaberite ispravnu opciju.
+
+
+ Please select a valid range.
+ Molim izaberite ispravan opseg.
+
+
+ Please enter a valid week.
+ Molim upišite ispravnu sedmicu.
+