Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 01e4d2d

Browse files
committed
Set options and handler only if the session is not yet active
1 parent a130101 commit 01e4d2d

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,20 @@ class NativeSessionStorage implements SessionStorageInterface
8888
*/
8989
public function __construct(array $options = array(), \SessionHandlerInterface $handler = null, MetadataBag $metaBag = null)
9090
{
91-
$options += array(
92-
// disable by default because it's managed by HeaderBag (if used)
93-
'cache_limiter' => '',
94-
'use_cookies' => 1,
95-
);
91+
$this->setMetadataBag($metaBag);
9692

97-
session_register_shutdown();
93+
if (\PHP_SESSION_ACTIVE !== session_status()) {
94+
$options += array(
95+
// disable by default because it's managed by HeaderBag (if used)
96+
'cache_limiter' => '',
97+
'use_cookies' => 1,
98+
);
9899

99-
$this->setMetadataBag($metaBag);
100-
$this->setOptions($options);
101-
$this->setSaveHandler($handler);
100+
session_register_shutdown();
101+
102+
$this->setOptions($options);
103+
$this->setSaveHandler($handler);
104+
}
102105
}
103106

104107
/**

0 commit comments

Comments
 (0)