From b8586cb99dc7a247e2847d43b379ee61cf722b10 Mon Sep 17 00:00:00 2001 From: Carlo Beltrame Date: Tue, 27 Oct 2020 15:02:07 +0100 Subject: [PATCH] Get laminas session configuration to work See https://github.com/laminas/laminas-session/issues/15#issuecomment-569998935 --- backend/config/autoload/sessions.global.php | 10 ++++++++++ backend/config/setup.config.php | 1 + backend/module/eCampCore/src/Module.php | 4 ++++ 3 files changed, 15 insertions(+) create mode 100644 backend/config/autoload/sessions.global.php diff --git a/backend/config/autoload/sessions.global.php b/backend/config/autoload/sessions.global.php new file mode 100644 index 00000000000..71527cf5dc1 --- /dev/null +++ b/backend/config/autoload/sessions.global.php @@ -0,0 +1,10 @@ + [ + 'cookie_domain' => '', + ], + 'session_storage' => [ + 'type' => 'Laminas\Session\Storage\SessionArrayStorage', + ], +]; diff --git a/backend/config/setup.config.php b/backend/config/setup.config.php index fffbc175b5e..a9062626755 100644 --- a/backend/config/setup.config.php +++ b/backend/config/setup.config.php @@ -6,6 +6,7 @@ // Retrieve the list of modules for this application. 'modules' => [ 'Laminas\\Router', + 'Laminas\\Session', 'Laminas\\Di', 'DoctrineModule', 'DoctrineORMModule', diff --git a/backend/module/eCampCore/src/Module.php b/backend/module/eCampCore/src/Module.php index accefef25cf..c0534f40a64 100644 --- a/backend/module/eCampCore/src/Module.php +++ b/backend/module/eCampCore/src/Module.php @@ -20,6 +20,10 @@ public function onBootstrap(MvcEvent $e) { $events = $app->getEventManager(); $sm = $app->getServiceManager(); + // Force loading the session config, in order to force using our custom config + // See https://github.com/laminas/laminas-session/issues/15#issuecomment-569998935 + $sm->get(\Laminas\Session\ManagerInterface::class); + /** @var EntityManager $em */ $em = $sm->get('doctrine.entitymanager.orm_default');