Skip to content

Commit 1d245fc

Browse files
Merge branch '4.1'
* 4.1: fix merge [travis][appveyor] use symfony/flex to accelerate builds Add missing stderr redirection clean up unused code Remove the HTML5 validation from the profiler URL search form [Filesystem] Add test to prevent regression when using array|resource with dumpFile Add help texts for checkboxes in horizontal bootstrap 4 forms [Security] Call AccessListener after LogoutListener
2 parents fa1ecc6 + a80ca20 commit 1d245fc

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

Firewall.php

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
1717
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
1818
use Symfony\Component\HttpKernel\KernelEvents;
19+
use Symfony\Component\Security\Http\Firewall\AccessListener;
1920
use Symfony\Component\Security\Http\Firewall\LogoutListener;
2021

2122
/**
@@ -55,20 +56,31 @@ public function onKernelRequest(GetResponseEvent $event)
5556
$listeners[2] = null;
5657
}
5758

58-
$authenticationListeners = $listeners[0];
59-
$exceptionListener = $listeners[1];
60-
$logoutListener = $listeners[2];
59+
$accessListener = null;
60+
$authenticationListeners = array();
6161

62-
if (null !== $exceptionListener) {
62+
foreach ($listeners[0] as $listener) {
63+
if ($listener instanceof AccessListener) {
64+
$accessListener = $listener;
65+
} else {
66+
$authenticationListeners[] = $listener;
67+
}
68+
}
69+
70+
if (null !== $exceptionListener = $listeners[1]) {
6371
$this->exceptionListeners[$event->getRequest()] = $exceptionListener;
6472
$exceptionListener->register($this->dispatcher);
6573
}
6674

67-
$this->handleRequest($event, $authenticationListeners);
75+
if (null !== $logoutListener = $listeners[2]) {
76+
$authenticationListeners[] = $logoutListener;
77+
}
6878

69-
if (null !== $logoutListener) {
70-
$logoutListener->handle($event);
79+
if (null !== $accessListener) {
80+
$authenticationListeners[] = $accessListener;
7181
}
82+
83+
$this->handleRequest($event, $authenticationListeners);
7284
}
7385

7486
public function onKernelFinishRequest(FinishRequestEvent $event)

Tests/FirewallTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function testOnKernelRequestStopsWhenThereIsAResponse()
8383
->getMock()
8484
;
8585
$event
86-
->expects($this->once())
86+
->expects($this->at(0))
8787
->method('hasResponse')
8888
->will($this->returnValue(true))
8989
;

0 commit comments

Comments
 (0)