Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zhang <peter@innocraft.com>2022-01-12 04:23:20 +0300
committerGitHub <noreply@github.com>2022-01-12 04:23:20 +0300
commitcfc3b46382b3e792f29958d4186864be2c4cdfa3 (patch)
tree38605244c92aca30c79010ad15c906e75d375588
parent3e4bfc21f0f6ccef6bc84410dffdf98eb4fb067b (diff)
move unsupported Browser check before create session (#18575)
* Update FrontController.php move unsupported Browser before create session * Update core/FrontController.php Co-authored-by: Stefan Giehl <stefan@matomo.org> * Update FrontControllerTest.php fix tests Co-authored-by: Stefan Giehl <stefan@matomo.org>
-rw-r--r--core/FrontController.php9
-rw-r--r--tests/PHPUnit/Integration/FrontControllerTest.php2
2 files changed, 7 insertions, 4 deletions
diff --git a/core/FrontController.php b/core/FrontController.php
index 448abb5b75..7ac273c089 100644
--- a/core/FrontController.php
+++ b/core/FrontController.php
@@ -396,6 +396,11 @@ class FrontController extends Singleton
$loggedIn = false;
+ //move this up unsupported Browser do not create session
+ if ($this->isSupportedBrowserCheckNeeded()) {
+ SupportedBrowser::checkIfBrowserSupported();
+ }
+
// don't use sessionauth in cli mode
// try authenticating w/ session first...
$sessionAuth = $this->makeSessionAuthenticator();
@@ -423,9 +428,7 @@ class FrontController extends Singleton
$this->makeAuthenticator($sessionAuth); // Piwik\Auth must be set to the correct Login plugin
}
- if ($this->isSupportedBrowserCheckNeeded()) {
- SupportedBrowser::checkIfBrowserSupported();
- }
+
// Force the auth to use the token_auth if specified, so that embed dashboard
// and all other non widgetized controller methods works fine
diff --git a/tests/PHPUnit/Integration/FrontControllerTest.php b/tests/PHPUnit/Integration/FrontControllerTest.php
index 1f0d9599c2..5def1a1b63 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(845): Piwik\EventDispatcher-&gt;postEvent('Request.dispatc...', Array, false, Array) #3 {includePath}/core/FrontController.php(599): Piwik\Piwik::postEvent('Request.dispatc...', Array) #4 {includePath}/core/FrontController.php(168): Piwik\FrontController-&gt;doDispatch('CoreHome', 'index', Array) #5 {includePath}/tests/resources/trigger-fatal-exception.php(31): Piwik\FrontController-&gt;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(845): Piwik\EventDispatcher-&gt;postEvent('Request.dispatc...', Array, false, Array) #3 {includePath}/core/FrontController.php(602): Piwik\Piwik::postEvent('Request.dispatc...', Array) #4 {includePath}/core/FrontController.php(168): Piwik\FrontController-&gt;doDispatch('CoreHome', 'index', Array) #5 {includePath}/tests/resources/trigger-fatal-exception.php(31): Piwik\FrontController-&gt;dispatch('CoreHome', 'index') #6 {main}
FORMAT;
$this->assertStringMatchesFormat($expectedFormat, $response['message']);
}