Skip to content

Commit 63ecc9c

Browse files
committed
feature #23114 [SecurityBundle] Lazy load security listeners (chalasr)
This PR was merged into the 3.4 branch. Discussion ---------- [SecurityBundle] Lazy load security listeners | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | yes (edge case) | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Each of them is heavy and unused if a previous one sets a response or breaks in the middle. Commits ------- e3ee6bc Lazy load security listeners
2 parents 1195c7d + e3ee6bc commit 63ecc9c

File tree

5 files changed

+22
-4
lines changed

5 files changed

+22
-4
lines changed

UPGRADE-3.4.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ UPGRADE FROM 3.3 to 3.4
44
DependencyInjection
55
-------------------
66

7-
* Top-level anonymous services in XML are deprecated and will throw an exception in Symfony 4.0.
7+
* Top-level anonymous services in XML are deprecated and will throw an exception in Symfony 4.0.
88

99
Finder
1010
------
@@ -32,6 +32,11 @@ Process
3232
* The `Symfony\Component\Process\ProcessBuilder` class has been deprecated,
3333
use the `Symfony\Component\Process\Process` class directly instead.
3434

35+
SecurityBundle
36+
--------------
37+
38+
* `FirewallContext::getListeners()` now returns `\Traversable|array`
39+
3540
Validator
3641
---------
3742

src/Symfony/Bundle/SecurityBundle/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
3.4.0
5+
-----
6+
7+
* [BC BREAK] `FirewallContext::getListeners()` now returns `\Traversable|array`
8+
49
3.3.0
510
-----
611

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ private function createFirewalls($config, ContainerBuilder $container)
265265
$contextId = 'security.firewall.map.context.'.$name;
266266
$context = $container->setDefinition($contextId, new ChildDefinition('security.firewall.context'));
267267
$context
268-
->replaceArgument(0, $listeners)
268+
->replaceArgument(0, new IteratorArgument($listeners))
269269
->replaceArgument(1, $exceptionListener)
270270
->replaceArgument(2, new Reference($configId))
271271
;

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ class FirewallContext
2525
private $exceptionListener;
2626
private $config;
2727

28-
public function __construct(array $listeners, ExceptionListener $exceptionListener = null, FirewallConfig $config = null)
28+
/**
29+
* @param \Traversable|array $listeners
30+
* @param ExceptionListener|null $exceptionListener
31+
* @param FirewallConfig|null $firewallConfig
32+
*/
33+
public function __construct($listeners, ExceptionListener $exceptionListener = null, FirewallConfig $config = null)
2934
{
3035
$this->listeners = $listeners;
3136
$this->exceptionListener = $exceptionListener;
@@ -47,6 +52,9 @@ public function getContext()
4752
return array($this->getListeners(), $this->getExceptionListener());
4853
}
4954

55+
/**
56+
* @return \Traversable|array
57+
*/
5058
public function getListeners()
5159
{
5260
return $this->listeners;

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function testFirewalls()
7272
foreach (array_keys($arguments[1]->getValues()) as $contextId) {
7373
$contextDef = $container->getDefinition($contextId);
7474
$arguments = $contextDef->getArguments();
75-
$listeners[] = array_map('strval', $arguments['index_0']);
75+
$listeners[] = array_map('strval', $arguments['index_0']->getValues());
7676

7777
$configDef = $container->getDefinition((string) $arguments['index_2']);
7878
$configs[] = array_values($configDef->getArguments());

0 commit comments

Comments
 (0)