[HttpFoundation] Throw exception when the \"session\" extension is not loaded

This commit is contained in:
Valentin Udaltsov 2019-06-27 13:35:22 +03:00 committed by Nicolas Grekas
parent 00552848f8
commit b0c663071b
3 changed files with 12 additions and 0 deletions

View File

@ -233,6 +233,10 @@ class FrameworkExtension extends Extension
}
if ($this->isConfigEnabled($container, $config['session'])) {
if (!\extension_loaded('session')) {
throw new \LogicException('PHP extension "session" is required.');
}
$this->sessionConfigEnabled = true;
$this->registerSessionConfiguration($config['session'], $container, $loader);
}

View File

@ -100,6 +100,10 @@ class NativeSessionStorage implements SessionStorageInterface
*/
public function __construct(array $options = [], $handler = null, MetadataBag $metaBag = null)
{
if (!\extension_loaded('session')) {
throw new \LogicException('PHP extension "session" is required.');
}
$options += [
'cache_limiter' => '',
'cache_expire' => 0,

View File

@ -24,6 +24,10 @@ class PhpBridgeSessionStorage extends NativeSessionStorage
*/
public function __construct($handler = null, MetadataBag $metaBag = null)
{
if (!\extension_loaded('session')) {
throw new \LogicException('PHP extension "session" is required.');
}
$this->setMetadataBag($metaBag);
$this->setSaveHandler($handler);
}