diff options
-rw-r--r-- | core/FrontController.php | 3 | ||||
-rw-r--r-- | tests/PHPUnit/Integration/FrontControllerTest.php | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/core/FrontController.php b/core/FrontController.php index 359df2fa99..3928587017 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -409,7 +409,8 @@ class FrontController extends Singleton && Piwik::isUserIsAnonymous() && $authAdapter->getLogin() === 'anonymous' //double checking the login && Piwik::isUserHasSomeViewAccess() - && Session::isSessionStarted()) { // only if session was started, don't do it eg for API + && Session::isSessionStarted() + && Session::isWritable()) { // only if session was started and writable, don't do it eg for API // usually the session would be started when someone logs in using login controller. But in this // case we need to init session here for anoynymous users $init = StaticContainer::get(SessionInitializer::class); diff --git a/tests/PHPUnit/Integration/FrontControllerTest.php b/tests/PHPUnit/Integration/FrontControllerTest.php index f8593e8495..0d2f3c82b6 100644 --- a/tests/PHPUnit/Integration/FrontControllerTest.php +++ b/tests/PHPUnit/Integration/FrontControllerTest.php @@ -48,7 +48,7 @@ FORMAT; $this->assertEquals('error', $response['result']); $expectedFormat = <<<FORMAT -test message on {includePath}/tests/resources/trigger-fatal-exception.php(23) #0 [internal function]: {closure}('CoreHome', 'index', Array) #1 {includePath}/core/EventDispatcher.php(141): call_user_func_array(Object(Closure), Array) #2 {includePath}/core/Piwik.php(809): Piwik\EventDispatcher->postEvent('Request.dispatc...', Array, false, Array) #3 {includePath}/core/FrontController.php(595): Piwik\Piwik::postEvent('Request.dispatc...', Array) #4 {includePath}/core/FrontController.php(167): Piwik\FrontController->doDispatch('CoreHome', 'index', Array) #5 {includePath}/tests/resources/trigger-fatal-exception.php(31): Piwik\FrontController->dispatch('CoreHome', 'index') #6 {main} +test message on {includePath}/tests/resources/trigger-fatal-exception.php(23) #0 [internal function]: {closure}('CoreHome', 'index', Array) #1 {includePath}/core/EventDispatcher.php(141): call_user_func_array(Object(Closure), Array) #2 {includePath}/core/Piwik.php(809): Piwik\EventDispatcher->postEvent('Request.dispatc...', Array, false, Array) #3 {includePath}/core/FrontController.php(596): Piwik\Piwik::postEvent('Request.dispatc...', Array) #4 {includePath}/core/FrontController.php(167): Piwik\FrontController->doDispatch('CoreHome', 'index', Array) #5 {includePath}/tests/resources/trigger-fatal-exception.php(31): Piwik\FrontController->dispatch('CoreHome', 'index') #6 {main} FORMAT; $this->assertStringMatchesFormat($expectedFormat, $response['message']); } |