Skip to content

Commit b6e8b17

Browse files
minor symfony#32215 [HttpFoundation] Throw exception when the "session" extension is not loaded (vudaltsov)
This PR was squashed before being merged into the 3.4 branch (closes symfony#32215). Discussion ---------- [HttpFoundation] Throw exception when the "session" extension is not loaded | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#31305 | License | MIT Should I target `3.4` or `master` instead? This change does not alter behavior, but makes the failure more clear. Commits ------- b0c6630 [HttpFoundation] Throw exception when the \"session\" extension is not loaded
2 parents 9bc8b39 + b0c6630 commit b6e8b17

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ public function load(array $configs, ContainerBuilder $container)
233233
}
234234

235235
if ($this->isConfigEnabled($container, $config['session'])) {
236+
if (!\extension_loaded('session')) {
237+
throw new \LogicException('PHP extension "session" is required.');
238+
}
239+
236240
$this->sessionConfigEnabled = true;
237241
$this->registerSessionConfiguration($config['session'], $container, $loader);
238242
}

src/Symfony/Component/HttpFoundation/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,

src/Symfony/Component/HttpFoundation/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)