diff --git a/app/AppKernel.php b/app/AppKernel.php index d1e2ec10ba7..11069870149 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -110,6 +110,14 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ $this->boot(); } + /* + * If we've already sent the response headers, and we have a session + * set in the request, set that as the session in the container. + */ + if (headers_sent() && $request->getSession()) { + $this->getContainer()->set('session', $request->getSession()); + } + // Check for an an active db connection and die with error if unable to connect if (!defined('MAUTIC_INSTALLER')) { $db = $this->getContainer()->get('database_connection'); diff --git a/index.php b/index.php index 18bee1a8974..b8db968ec41 100644 --- a/index.php +++ b/index.php @@ -29,6 +29,9 @@ \Mautic\CoreBundle\ErrorHandler\ErrorHandler::register('prod'); $kernel = new AppKernel('prod', false); -$kernel->loadClassCache(); + +if (version_compare(PHP_VERSION, '7.0.0', '<')) { + $kernel->loadClassCache(); +} Stack\run((new MiddlewareBuilder('prod'))->resolve($kernel)); diff --git a/index_dev.php b/index_dev.php index b1e99b85ed7..b4607bdd81e 100644 --- a/index_dev.php +++ b/index_dev.php @@ -29,6 +29,5 @@ \Mautic\CoreBundle\ErrorHandler\ErrorHandler::register('dev'); $kernel = new AppKernel('dev', true); -$kernel->loadClassCache(); Stack\run((new MiddlewareBuilder('dev'))->resolve($kernel));