Skip to content

Commit e4e7454

Browse files
committed
Allows to use a Traversable object as map
1 parent fb0b831 commit e4e7454

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,14 @@ public function getFirewallConfig(Request $request)
147147
private function getFirewallContext(Request $request)
148148
{
149149
if ($request->attributes->has('_firewall_context')) {
150-
$contextId = $request->attributes->get('_firewall_context');
151-
if (array_key_exists($contextId, $this->map)) {
152-
return $this->container->get($contextId);
153-
} else {
154-
$request->attributes->remove('_firewall_context');
150+
$storedContextId = $request->attributes->get('_firewall_context');
151+
foreach ($this->map as $contextId => $requestMatcher) {
152+
if ($contextId === $storedContextId) {
153+
return $this->container->get($contextId);
154+
}
155155
}
156+
157+
$request->attributes->remove('_firewall_context');
156158
}
157159

158160
foreach ($this->map as $contextId => $requestMatcher) {

0 commit comments

Comments
 (0)