Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d6a402a

Browse files
committed
[Security] fixed path info encoding (closes #6040, closes #5695)
1 parent 47dfb9c commit d6a402a

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/Symfony/Component/Security/Http/HttpUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function checkRequestPath(Request $request, $path)
106106
}
107107
}
108108

109-
return $path === $request->getPathInfo();
109+
return $path === rawurldecode($request->getPathInfo());
110110
}
111111

112112
/**

src/Symfony/Component/Security/Tests/Http/HttpUtilsTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ public function testCheckRequestPath()
9797

9898
$this->assertTrue($utils->checkRequestPath($this->getRequest(), '/'));
9999
$this->assertFalse($utils->checkRequestPath($this->getRequest(), '/foo'));
100+
$this->assertTrue($utils->checkRequestPath($this->getRequest('/foo%20bar'), '/foo bar'));
101+
// Plus must not decoded to space
102+
$this->assertTrue($utils->checkRequestPath($this->getRequest('/foo+bar'), '/foo+bar'));
103+
// Checking unicode
104+
$this->assertTrue($utils->checkRequestPath($this->getRequest(urlencode('/вход')), '/вход'));
100105

101106
$urlMatcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
102107
$urlMatcher

0 commit comments

Comments
 (0)