minor #13103 [SecurityBundle] avoid unneeded work (fabpot)

This PR was merged into the 2.3 branch.

Discussion
----------

[SecurityBundle] avoid unneeded work

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #13018
| License       | MIT
| Doc PR        | n/a

Commits
-------

8135727 [SecurityBundle] avoid unneeded work
This commit is contained in:
Fabien Potencier 2014-12-25 20:42:32 +01:00
commit 49dd88ff86
1 changed files with 4 additions and 4 deletions

View File

@ -567,6 +567,10 @@ class SecurityExtension extends Extension
private function createRequestMatcher($container, $path = null, $host = null, $methods = array(), $ip = null, array $attributes = array())
{
if ($methods) {
$methods = array_map('strtoupper', (array) $methods);
}
$serialized = serialize(array($path, $host, $methods, $ip, $attributes));
$id = 'security.request_matcher.'.md5($serialized).sha1($serialized);
@ -574,10 +578,6 @@ class SecurityExtension extends Extension
return $this->requestMatchers[$id];
}
if ($methods) {
$methods = array_map('strtoupper', (array) $methods);
}
// only add arguments that are necessary
$arguments = array($path, $host, $methods, $ip, $attributes);
while (count($arguments) > 0 && !end($arguments)) {