Commit 3555e2b4 authored by alexpott's avatar alexpott
Browse files

Issue #2538982 by dawehner, pwolanin, Fabianx: Get rid of strtr in UrlGenerator, it is not needed

parent 5a9f6e7d
......@@ -54,14 +54,19 @@ class UrlGenerator implements UrlGeneratorInterface {
* Overrides characters that will not be percent-encoded in the path segment.
* The first two elements are the first two parameters of str_replace(), so
* if you override this variable you can also use arrays for the encoded
* and decoded characters.
* @see \Symfony\Component\Routing\Generator\UrlGenerator
protected $decodedChars = array(
protected $decodedChars = [
// the slash can be used to designate a hierarchical structure and we want allow using it with this meaning
// some webservers don't allow the slash in encoded form in the path for security reasons anyway
// see
'%2F' => '/',
'%2F', // Map from these encoded characters.
'/', // Map to these decoded characters.
* Constructs a new generator object.
......@@ -211,7 +216,7 @@ protected function doGenerate(array $variables, array $defaults, array $tokens,
// The contexts base URL is already encoded (see Symfony\Component\HttpFoundation\Request)
$url = strtr(rawurlencode($url), $this->decodedChars);
$url = str_replace($this->decodedChars[0], $this->decodedChars[1], rawurlencode($url));
// Drupal paths rarely include dots, so skip this processing if possible.
if (strpos($url, '/.') !== FALSE) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment