Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure SpoonSession is initialised before starting symfony session #2023

Merged
merged 2 commits into from Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions app/config/config.yml
Expand Up @@ -4,6 +4,7 @@ imports:

parameters:
translator.identity.class: Common\Language
session.storage.php_bridge.class: Common\Core\Session\Storage\PhpBridgeSessionStorage

framework:
secret: %kernel.secret%
Expand Down
28 changes: 28 additions & 0 deletions src/Common/Core/Session/Storage/PhpBridgeSessionStorage.php
@@ -0,0 +1,28 @@
<?php

namespace Common\Core\Session\Storage;

use SpoonSession;
use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage as SymfonyPhpBridgeSessionStorage;

/**
* In most cases we will only access the symfony sessions after SpoonSession has started. But in the cases where that
* is not the case the symfony sessions didn't work because of some stuff happening in SpoonSession.
* This will fix that issue by making sure that when we start the symfony sessions the SpoonSessions also have started.
*/
final class PhpBridgeSessionStorage extends SymfonyPhpBridgeSessionStorage
{
/**
* {@inheritdoc}
*/
public function start()
{
if ($this->started) {
return true;
}

SpoonSession::start();

return parent::start();
}
}