Skip to content

Commit

Permalink
loadClassCache causes issues in PHP 7 when a plugin makes use of the …
Browse files Browse the repository at this point in the history
…new RedirectGenerationEvent and a middleware that sets headers such as cookies. This is deprecated in Symfony 3.3 anyway.
  • Loading branch information
alanhartless committed Jul 27, 2018
1 parent 218ba40 commit 4e5da30
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
5 changes: 4 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
1 change: 0 additions & 1 deletion index_dev.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@
\Mautic\CoreBundle\ErrorHandler\ErrorHandler::register('dev');

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

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

0 comments on commit 4e5da30

Please # to comment.