Created
March 25, 2014 06:17
-
-
Save tcz/9756112 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; | |
/** | |
* Session sotrage that avoids using _sf2_attributes subkey | |
* in the $_SESSION superglobal but instead it uses | |
* the root variable. | |
*/ | |
class LegacySessionStorage extends NativeSessionStorage | |
{ | |
const SYMFONY_SESSION_SUBKEY = '_sf2_attributes'; | |
/** | |
* @inheritdoc | |
*/ | |
protected function loadSession(array &$session = null) | |
{ | |
if (null === $session) { | |
$session = &$_SESSION; | |
} | |
parent::loadSession($session); | |
foreach ($this->bags as $bag) { | |
$key = $bag->getStorageKey(); | |
if (self::SYMFONY_SESSION_SUBKEY === $key) | |
{ | |
$bag->initialize($session); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment