From 7e1c6b6137026c78b3fa16484bbf9fc110b47bda Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 9 Mar 2018 21:07:44 +0200 Subject: [PATCH] Do not initialize session in CLI and unit tests --- system/src/Grav/Common/Session.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/system/src/Grav/Common/Session.php b/system/src/Grav/Common/Session.php index 87f7e83b8..528690493 100644 --- a/system/src/Grav/Common/Session.php +++ b/system/src/Grav/Common/Session.php @@ -15,6 +15,19 @@ class Session extends BaseSession /** @var bool */ protected $autoStart = false; + /** + * @param int $lifetime Defaults to 1800 seconds. + * @param string $path Cookie path. + * @param string $domain Optional, domain for the session + * @throws \RuntimeException + */ + public function __construct($lifetime, $path, $domain = null) + { + if (php_sapi_name() !== 'cli') { + parent::__construct($lifetime, $path, $domain); + } + } + /** * Initialize session. *