summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2012-12-11 10:40:14 +0100
committerFabien Potencier <fabien.potencier@gmail.com>2012-12-11 10:40:23 +0100
commit547b1b0225cd1d9561f370a7efd4b76f0f9260f3 (patch)
treede26b8b0c6da424c09fdaf8415057bcaeae2c227
parenta24042b565a4395b76622513857a059b2ef26ba3 (diff)
downloadsymfony-security-547b1b0225cd1d9561f370a7efd4b76f0f9260f3.zip
symfony-security-547b1b0225cd1d9561f370a7efd4b76f0f9260f3.tar.gz
symfony-security-547b1b0225cd1d9561f370a7efd4b76f0f9260f3.tar.bz2
[Security] fixed path info encoding (closes #6040, closes #5695)
-rw-r--r--Http/HttpUtils.php2
-rw-r--r--Tests/Http/HttpUtilsTest.php5
2 files changed, 6 insertions, 1 deletions
diff --git a/Http/HttpUtils.php b/Http/HttpUtils.php
index 1c87e77..76cfc6a 100644
--- a/Http/HttpUtils.php
+++ b/Http/HttpUtils.php
@@ -106,7 +106,7 @@ class HttpUtils
}
}
- return $path === $request->getPathInfo();
+ return $path === rawurldecode($request->getPathInfo());
}
/**
diff --git a/Tests/Http/HttpUtilsTest.php b/Tests/Http/HttpUtilsTest.php
index a30051f..fc1b754 100644
--- a/Tests/Http/HttpUtilsTest.php
+++ b/Tests/Http/HttpUtilsTest.php
@@ -97,6 +97,11 @@ class HttpUtilsTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($utils->checkRequestPath($this->getRequest(), '/'));
$this->assertFalse($utils->checkRequestPath($this->getRequest(), '/foo'));
+ $this->assertTrue($utils->checkRequestPath($this->getRequest('/foo%20bar'), '/foo bar'));
+ // Plus must not decoded to space
+ $this->assertTrue($utils->checkRequestPath($this->getRequest('/foo+bar'), '/foo+bar'));
+ // Checking unicode
+ $this->assertTrue($utils->checkRequestPath($this->getRequest(urlencode('/вход')), '/вход'));
$urlMatcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
$urlMatcher