Skip to content

Commit 6005107

Browse files
vudaltsovnicolas-grekas
authored andcommitted
[HttpFoundation] Throw exception when the \"session\" extension is not loaded
1 parent f9bb073 commit 6005107

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Session/Storage/NativeSessionStorage.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ class NativeSessionStorage implements SessionStorageInterface
100100
*/
101101
public function __construct(array $options = [], $handler = null, MetadataBag $metaBag = null)
102102
{
103+
if (!\extension_loaded('session')) {
104+
throw new \LogicException('PHP extension "session" is required.');
105+
}
106+
103107
$options += [
104108
'cache_limiter' => '',
105109
'cache_expire' => 0,

Session/Storage/PhpBridgeSessionStorage.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ class PhpBridgeSessionStorage extends NativeSessionStorage
2424
*/
2525
public function __construct($handler = null, MetadataBag $metaBag = null)
2626
{
27+
if (!\extension_loaded('session')) {
28+
throw new \LogicException('PHP extension "session" is required.');
29+
}
30+
2731
$this->setMetadataBag($metaBag);
2832
$this->setSaveHandler($handler);
2933
}

0 commit comments

Comments
 (0)