summaryrefslogtreecommitdiffstats
path: root/Http/HttpUtils.php
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2011-07-11 08:09:36 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2011-07-11 08:09:36 +0200
commit24f60c28bd53c67ba1febc4192b8ea10fba03c6f (patch)
tree4d22488c3e2b17c8d84418ee47c10534249fed21 /Http/HttpUtils.php
parentbd8281fcec61e9edfc582cc93de297174db528b1 (diff)
downloadsymfony-security-24f60c28bd53c67ba1febc4192b8ea10fba03c6f.zip
symfony-security-24f60c28bd53c67ba1febc4192b8ea10fba03c6f.tar.gz
symfony-security-24f60c28bd53c67ba1febc4192b8ea10fba03c6f.tar.bz2
[Security] fixed redirection URLs when using {_locale} in the pattern
Diffstat (limited to 'Http/HttpUtils.php')
-rw-r--r--Http/HttpUtils.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/Http/HttpUtils.php b/Http/HttpUtils.php
index 9ac604e..51168cc 100644
--- a/Http/HttpUtils.php
+++ b/Http/HttpUtils.php
@@ -48,6 +48,19 @@ class HttpUtils
if (0 === strpos($path, '/')) {
$path = $request->getUriForPath($path);
} elseif (0 !== strpos($path, 'http')) {
+ // hack (don't have a better solution for now)
+ $context = $this->router->getContext();
+ try {
+ $parameters = $this->router->match($request->getPathInfo());
+ } catch (\Exception $e) {
+ }
+
+ if (isset($parameters['_locale'])) {
+ $context->setParameter('_locale', $parameters['_locale']);
+ } elseif ($session = $request->getSession()) {
+ $context->setParameter('_locale', $session->getLocale());
+ }
+
$path = $this->generateUrl($path, true);
}