[HttpFoundation] Avoid a few unnecessary str_replace() calls
This commit is contained in:
parent
f5e7f24819
commit
997d549846
@ -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()))) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user