From 02c40ad1cbc66cadea77180b8b9340521381cce5 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Tue, 10 Dec 2019 23:35:16 +0100 Subject: [PATCH] Overwrite constructor of Memory session handling so no session ini-setting in backend/testing environments are possible --- src/Core/Session/Memory.php | 8 ++++++++ tests/include/ApiTest.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Core/Session/Memory.php b/src/Core/Session/Memory.php index b39234db23..f8d02b5538 100644 --- a/src/Core/Session/Memory.php +++ b/src/Core/Session/Memory.php @@ -2,6 +2,9 @@ namespace Friendica\Core\Session; +use Friendica\Core\Config\Configuration; +use Friendica\Model\User\Cookie; + /** * Usable for backend processes (daemon/worker) and testing * @@ -9,6 +12,11 @@ namespace Friendica\Core\Session; */ final class Memory extends Native { + public function __construct(Configuration $config, Cookie $cookie) + { + $this->cookie = $cookie; + } + public function start() { // Backward compatibility until all Session variables are replaced diff --git a/tests/include/ApiTest.php b/tests/include/ApiTest.php index 63e8d23453..ef46a4d447 100644 --- a/tests/include/ApiTest.php +++ b/tests/include/ApiTest.php @@ -62,7 +62,7 @@ class ApiTest extends DatabaseTest $this->dice = (new Dice()) ->addRules(include __DIR__ . '/../../static/dependencies.config.php') ->addRule(Database::class, ['instanceOf' => StaticDatabase::class, 'shared' => true]) - ->addRule(ISession::class, ['instanceOf' => Session\Memory::class, 'shared' => true]); + ->addRule(ISession::class, ['instanceOf' => Session\Memory::class, 'shared' => true, 'call' => null]); BaseObject::setDependencyInjection($this->dice); /** @var Database $dba */