diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml
index a4e4afdba5683..55180b6027222 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml
@@ -53,8 +53,14 @@
-
-
+
+
+
+
+
+
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/test.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/test.xml
index 943c56310b93c..719c84aa1039a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/test.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/test.xml
@@ -22,8 +22,14 @@
-
-
+
+
+
+
+
+
+
+
diff --git a/src/Symfony/Component/HttpKernel/EventListener/SessionListener.php b/src/Symfony/Component/HttpKernel/EventListener/SessionListener.php
index a6a7de7550a51..39ebfd922fac6 100644
--- a/src/Symfony/Component/HttpKernel/EventListener/SessionListener.php
+++ b/src/Symfony/Component/HttpKernel/EventListener/SessionListener.php
@@ -12,8 +12,6 @@
namespace Symfony\Component\HttpKernel\EventListener;
use Psr\Container\ContainerInterface;
-use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
-use Symfony\Component\HttpFoundation\Session\SessionInterface;
/**
* Sets the session in the request.
@@ -22,7 +20,7 @@
*
* @final since version 3.3
*/
-class SessionListener extends AbstractSessionListener implements ServiceSubscriberInterface
+class SessionListener extends AbstractSessionListener
{
private $container;
@@ -39,14 +37,4 @@ protected function getSession()
return $this->container->get('session');
}
-
- /**
- * {@inheritdoc}
- */
- public static function getSubscribedServices()
- {
- return array(
- 'session' => '?'.SessionInterface::class,
- );
- }
}
diff --git a/src/Symfony/Component/HttpKernel/EventListener/TestSessionListener.php b/src/Symfony/Component/HttpKernel/EventListener/TestSessionListener.php
index 769eb3b6d033c..36abb422f4f6d 100644
--- a/src/Symfony/Component/HttpKernel/EventListener/TestSessionListener.php
+++ b/src/Symfony/Component/HttpKernel/EventListener/TestSessionListener.php
@@ -12,8 +12,6 @@
namespace Symfony\Component\HttpKernel\EventListener;
use Psr\Container\ContainerInterface;
-use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
-use Symfony\Component\HttpFoundation\Session\SessionInterface;
/**
* Sets the session in the request.
@@ -22,7 +20,7 @@
*
* @final since version 3.3
*/
-class TestSessionListener extends AbstractTestSessionListener implements ServiceSubscriberInterface
+class TestSessionListener extends AbstractTestSessionListener
{
private $container;
@@ -39,14 +37,4 @@ protected function getSession()
return $this->container->get('session');
}
-
- /**
- * {@inheritdoc}
- */
- public static function getSubscribedServices()
- {
- return array(
- 'session' => '?'.SessionInterface::class,
- );
- }
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php
index 2e51d42d150f3..8ada8e7dd8baa 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php
@@ -12,10 +12,13 @@
namespace Symfony\Component\HttpKernel\Tests\EventListener;
use PHPUnit\Framework\TestCase;
+use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
+use Symfony\Component\HttpKernel\EventListener\SessionListener;
+use Symfony\Component\HttpKernel\EventListener\TestSessionListener;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
/**
@@ -79,6 +82,15 @@ public function testUnstartedSessionIsNotSave()
$this->filterResponse(new Request());
}
+ public function testDoesNotImplementServiceSubscriberInterface()
+ {
+ $this->assertTrue(interface_exists(ServiceSubscriberInterface::class));
+ $this->assertTrue(class_exists(SessionListener::class));
+ $this->assertTrue(class_exists(TestSessionListener::class));
+ $this->assertFalse(is_subclass_of(SessionListener::class, ServiceSubscriberInterface::class), 'Implementing ServiceSubscriberInterface would create a dep on the DI component, which eg Silex cannot afford');
+ $this->assertFalse(is_subclass_of(TestSessionListener::class, ServiceSubscriberInterface::class, 'Implementing ServiceSubscriberInterface would create a dep on the DI component, which eg Silex cannot afford'));
+ }
+
private function filterResponse(Request $request, $type = HttpKernelInterface::MASTER_REQUEST)
{
$request->setSession($this->session);