8000 Merge branch '2.8' into 3.2 · symfony/symfony@fcde9e6 · GitHub
[go: up one dir, main page]

Skip to content

Commit fcde9e6

Browse files
Merge branch '2.8' into 3.2
* 2.8: Revert "bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)" [DependencyInjection] inline conditional statements.
2 parents 65b7d43 + 15106bf commit fcde9e6

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,16 @@ private function createFirewalls($config, ContainerBuilder $container)
223223
$firewalls = $config['firewalls'];
224224
$providerIds = $this->createUserProviders($config, $container);
225225

226+
// make the ContextListener aware of the configured user providers
227+
$definition = $container->getDefinition('security.context_listener');
228+
$arguments = $definition->getArguments();
229+
$userProviders = array();
230+
foreach ($providerIds as $userProviderId) {
231+
$userProviders[] = new Reference($userProviderId);
232+
}
233+
$arguments[1] = $userProviders;
234+
$definition->setArguments($arguments);
235+
226236
// load firewall map
227237
$mapDef = $container->getDefinition('security.firewall.map');
228238
$map = $authenticationProviders = array();
@@ -304,7 +314,7 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
304314
$contextKey = $firewall['context'];
305315
}
306316

307-
$listeners[] = new Reference($this->createContextListener($container, $contextKey, $defaultProvider));
317+
$listeners[] = new Reference($this->createContextListener($container, $contextKey));
308318
}
309319

310320
$config->replaceArgument(6, $contextKey);
@@ -413,15 +423,14 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
413423
return array($matcher, $listeners, $exceptionListener);
414424
}
415425

416-
private function createContextListener($container, $contextKey, $providerId)
426+
private function createContextListener($container, $contextKey)
417427
{
418428
if (isset($this->contextListeners[$contextKey])) {
419429
return $this->contextListeners[$contextKey];
420430
}
421431

422432
$listenerId = 'security.context_listener.'.count($this->contextListeners);
423433
$listener = $container->setDefinition($listenerId, new DefinitionDecorator('security.context_listener'));
424-
$listener->replaceArgument(1, array(new Reference($providerId)));
425434
$listener->replaceArgument(2, $contextKey);
426435

427436
return $this->contextListeners[$contextKey] = $listenerId;

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -963,11 +963,7 @@ private function addPrivateServices()
963963
private function addAliases()
964964
{
965965
if (!$aliases = $this->container->getAliases()) {
966-
if ($this->container->isFrozen()) {
967-
return "\n \$this->aliases = array();\n";
968-
} else {
969-
return '';
970-
}
966+
return $this->container->isFrozen() ? "\n \$this->aliases = array();\n" : '';
971967
}
972968

973969
$code = " \$this->aliases = array(\n";
@@ -1426,9 +1422,9 @@ private function dumpValue($value, $interpolate = true)
14261422
}
14271423
} elseif (is_object($value) || is_resource($value)) {
14281424
throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.');
1429-
} else {
1430-
return $this->export($value);
14311425
}
1426+
1427+
return $this->export($value);
14321428
}
14331429

14341430
/**
@@ -1489,13 +1485,13 @@ private function getServiceCall($id, Reference $reference = null)
14891485
}
14901486
if (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) {
14911487
return sprintf('$this->get(\'%s\', ContainerInterface::NULL_ON_INVALID_REFERENCE)', $id);
1492-
} else {
1493-
if ($this->container->hasAlias($id)) {
1494-
$id = (string) $this->container->getAlias($id);
1495-
}
1488+
}
14961489

1497-
return sprintf('$this->get(\'%s\')', $id);
1490+
if ($this->container->hasAlias($id)) {
1491+
$id = (string) $this->container->getAlias($id);
14981492
}
1493+
1494+
return sprintf('$this->get(\'%s\')', $id);
14991495
}
15001496

15011497
/**

0 commit comments

Comments
 (0)
0