Skip to content

Commit 4e5da30

Browse files
committed
loadClassCache causes issues in PHP 7 when a plugin makes use of the new RedirectGenerationEvent and a middleware that sets headers such as cookies. This is deprecated in Symfony 3.3 anyway.
1 parent 218ba40 commit 4e5da30

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

app/AppKernel.php

+8
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
110110
$this->boot();
111111
}
112112

113+
/*
114+
* If we've already sent the response headers, and we have a session
115+
* set in the request, set that as the session in the container.
116+
*/
117+
if (headers_sent() && $request->getSession()) {
118+
$this->getContainer()->set('session', $request->getSession());
119+
}
120+
113121
// Check for an an active db connection and die with error if unable to connect
114122
if (!defined('MAUTIC_INSTALLER')) {
115123
$db = $this->getContainer()->get('database_connection');

index.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
\Mautic\CoreBundle\ErrorHandler\ErrorHandler::register('prod');
3030

3131
$kernel = new AppKernel('prod', false);
32-
$kernel->loadClassCache();
32+
33+
if (version_compare(PHP_VERSION, '7.0.0', '<')) {
34+
$kernel->loadClassCache();
35+
}
3336

3437
Stack\run((new MiddlewareBuilder('prod'))->resolve($kernel));

index_dev.php

-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,5 @@
2929
\Mautic\CoreBundle\ErrorHandler\ErrorHandler::register('dev');
3030

3131
$kernel = new AppKernel('dev', true);
32-
$kernel->loadClassCache();
3332

3433
Stack\run((new MiddlewareBuilder('dev'))->resolve($kernel));

0 commit comments

Comments
 (0)