diff --git a/src/Symfony/Component/HttpFoundation/RequestMatcher.php b/src/Symfony/Component/HttpFoundation/RequestMatcher.php index b4bc880d4a..769ca66ecd 100644 --- a/src/Symfony/Component/HttpFoundation/RequestMatcher.php +++ b/src/Symfony/Component/HttpFoundation/RequestMatcher.php @@ -136,20 +136,16 @@ class RequestMatcher implements RequestMatcherInterface } foreach ($this->attributes as $key => $pattern) { - if (!preg_match('#'.str_replace('#', '\\#', $pattern).'#', $request->attributes->get($key))) { + if (!preg_match('{'.$pattern.'}', $request->attributes->get($key))) { return false; } } - if (null !== $this->path) { - $path = str_replace('#', '\\#', $this->path); - - if (!preg_match('#'.$path.'#', rawurldecode($request->getPathInfo()))) { - return false; - } + if (null !== $this->path && !preg_match('{'.$this->path.'}', rawurldecode($request->getPathInfo()))) { + return false; } - if (null !== $this->host && !preg_match('#'.str_replace('#', '\\#', $this->host).'#i', $request->getHost())) { + if (null !== $this->host && !preg_match('{'.$this->host.'}i', $request->getHost())) { return false; }