Skip to content

Commit bd02894

Browse files
committed
Merge branch '1.3' into travis
Conflicts: .travis.yml CHANGELOG.md src/EventListener/SessionListener.php
2 parents a42c8d3 + c5798e9 commit bd02894

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ access to other services.)
189189
* Added an option `always_vary_on_context_hash` to make it possible to disable
190190
automatically setting the vary headers for the user hash.
191191

192+
1.3.16
193+
------
194+
195+
* Adjust session_listener to work with Symfony 3.4.12 (https://github.com/symfony/symfony/pull/27467).
196+
192197
1.3.15
193198
------
194199

src/EventListener/SessionListener.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1515
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
16+
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
1617
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
1718
use Symfony\Component\HttpKernel\EventListener\SessionListener as BaseSessionListener;
1819

@@ -81,7 +82,13 @@ public function onKernelResponse(FilterResponseEvent $event)
8182
// noop, see class description
8283
}
8384

84-
public static function getSubscribedEvents(): array
85+
public function onFinishRequest(FinishRequestEvent $event)
86+
{
87+
// this hook has been added in symfony 3.4.12 - older versions of the listener do not register for it
88+
$this->inner->onFinishRequest($event);
89+
}
90+
91+
public static function getSubscribedEvents()
8592
{
8693
return BaseSessionListener::getSubscribedEvents();
8794
}

tests/Unit/EventListener/SessionListenerTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,32 @@ public function testOnKernelRequestRemainsUntouched()
3838
$listener->onKernelRequest($event);
3939
}
4040

41+
public function testOnFinishRequestRemainsUntouched()
42+
{
43+
if (!method_exists('Symfony\Component\HttpKernel\EventListener\SessionListener', 'onFinishRequest')) {
44+
$this->markTestSkipped('Method onFinishRequest does not exist on Symfony\Component\HttpKernel\EventListener\SessionListener');
45+
}
46+
47+
$event = $this
48+
->getMockBuilder('Symfony\Component\HttpKernel\Event\FinishRequestEvent')
49+
->disableOriginalConstructor()
50+
->getMock();
51+
52+
$inner = $this
53+
->getMockBuilder('Symfony\Component\HttpKernel\EventListener\SessionListener')
54+
->disableOriginalConstructor()
55+
->getMock();
56+
57+
$inner
58+
->expects($this->once())
59+
->method('onFinishRequest')
60+
->with($event)
61+
;
62+
63+
$listener = $this->getListener($inner);
64+
$listener->onFinishRequest($event);
65+
}
66+
4167
/**
4268
* @dataProvider onKernelResponseProvider
4369
*/

0 commit comments

Comments
 (0)