8000 Allow to set options & handler only if session is not active · symfony/symfony@1677777 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1677777

committed
Allow to set options & handler only if session is not active
1 parent 01e4d2d commit 1677777

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ public function __construct(array $options = array(), \SessionHandlerInterface $
9090
{
9191
$this->setMetadataBag($metaBag);
9292

93-
if (\PHP_SESSION_ACTIVE !== session_status()) {
93+
if (\PHP_SESSION_ACTIVE === session_status()) {
94+
if (!empty($options) || null !== $handler) {
95+
throw new \LogicException('Cannot change options or handler of an active session');
96+
}
97+
} else {
9498
$options += array(
9599
// disable by default because it's managed by HeaderBag (if used)
96100
'cache_limiter' => '',

0 commit comments

Comments
 (0)
0