summaryrefslogtreecommitdiffstats
path: root/Http/HttpUtils.php
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2013-03-15 11:14:31 +0100
committerFabien Potencier <fabien.potencier@gmail.com>2013-03-15 11:14:31 +0100
commitbdbbec5781db6cd74bf74c44920ed10c0feaa344 (patch)
treeab1657378a539cb6862002c30767bb5357b865c4 /Http/HttpUtils.php
parent54ec1c91bc1f7627d7ef3eaec8f8449872defc1f (diff)
parent92e984abfa1dba54b8a25e5492f7696bfaf0cb25 (diff)
downloadsymfony-security-bdbbec5781db6cd74bf74c44920ed10c0feaa344.zip
symfony-security-bdbbec5781db6cd74bf74c44920ed10c0feaa344.tar.gz
symfony-security-bdbbec5781db6cd74bf74c44920ed10c0feaa344.tar.bz2
Merge branch '2.1' into 2.2
* 2.1: sub-requests are now created with the same class as their parent [FrameworkBundle] removed BC break [FrameworkBundle] changed temp kernel name in cache:clear [DoctrineBridge] Avoids blob values to be logged by doctrine [Security] use current request attributes to generate redirect url? [Validator] fix showing wrong max file size for upload errors [TwigBridge] removed double var initialization (refs #7344) [2.1][TwigBridge] Fixes Issue #7342 in TwigBridge [FrameworkBundle] fixed cahe:clear command's warmup [TwigBridge] now enter/leave scope on Twig_Node_Module [TwigBridge] fixed fixed scope & trans_default_domain node visitor [TwigBridge] fixed non probant tests & added new one [BrowserKit] added ability to ignored malformed set-cookie header [Translation] removed wriong 'use' [Translation] added xliff loader/dumper with resname support [TwigBridge] fixes Conflicts: src/Symfony/Bundle/FrameworkBundle/HttpKernel.php src/Symfony/Component/Security/Http/HttpUtils.php src/Symfony/Component/Translation/Loader/XliffFileLoader.php src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
Diffstat (limited to 'Http/HttpUtils.php')
-rw-r--r--Http/HttpUtils.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/Http/HttpUtils.php b/Http/HttpUtils.php
index eb7894c..28373a7 100644
--- a/Http/HttpUtils.php
+++ b/Http/HttpUtils.php
@@ -70,7 +70,7 @@ class HttpUtils
*/
public function createRequest(Request $request, $path)
{
- $newRequest = Request::create($this->generateUri($request, $path), 'get', array(), $request->cookies->all(), array(), $request->server->all());
+ $newRequest = call_user_func(array(get_class($request), 'create'), $this->generateUri($request, $path), 'get', array(), $request->cookies->all(), array(), $request->server->all());
if ($request->hasSession()) {
$newRequest->setSession($request->getSession());
}
@@ -140,6 +140,16 @@ class HttpUtils
throw new \LogicException('You must provide a UrlGeneratorInterface instance to be able to use routes.');
}
- return $this->urlGenerator->generate($path, array(), UrlGeneratorInterface::ABSOLUTE_URL);
+ $url = $this->urlGenerator->generate($path, $attributes, UrlGeneratorInterface::ABSOLUTE_URL);
+
+ // unnecessary query string parameters must be removed from url
+ // (ie. query parameters that are presents in $attributes)
+ // fortunately, they all are, so we have to remove entire query string
+ $position = strpos($url, '?');
+ if (false !== $position) {
+ $url = substr($url, 0, $position);
+ }
+
+ return $url;
}
}