symfony/symfony — Issue #2962: Percents in URLs are decoded twice
Author: arnaud-lb
Created: 2011-12-26 12:59:44+00:00
State: open

The pathinfo is urldecoded() twice: One time in Request->getPathinfo() and a second time in UrlMatcher->match().

Example: For the URL `/foo/bar%252Fbaz` getPathInfo() returns `/foo/bar%2Fbaz`, and match() decodes it again as `/foo/bar/baz`.

This may change the meaning of the URL.

This is more problematic when the URL contains `%25` (an encoded `%`) because decoding it twice will eat the two next bytes: `/foo%25feed/bar` -> `/foo%feed/bar` -> `/foo�ed/bar`

Either getPathinfo() or match() shouldn't decode the pathinfo. The PATH_INFO environment variable is not decoded, so I think getPathinfo() souldn't decode it.