Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error "The parameter 'period' isn't set in the Request, and a default value wasn't provided." in userSecurity #19722

Closed
tsteur opened this issue Sep 12, 2022 · 4 comments · Fixed by #19724
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@tsteur
Copy link
Member

tsteur commented Sep 12, 2022

Error: {"message":"An exception has been thrown during the rendering of a template ("The parameter 'period' isn't set in the Request, and a default value wasn't provided.").","file":"/plugins/UsersManager/templates/userSecurity.twig","line":53,"request_id":"01ca6","backtrace":" on /plugins/UsersManager/templates/userSecurity.twig(53)\n#0 /tmp/templates_c/e6/e68b9b1c0d3eb0bcc91948372a47073c7df114067dde708b0b7c77abef8a0b2c.php(157): Twig\Template->displayBlock('content', Array, Array)\n#1 /vendor/twig/twig/src/Template.php(171): __TwigTemplate_cdb2cc63806c3af273367083c3a0ceba749eb89c89d6a5ec57ab9a842268f07e->block_root(Array, Array)\n#2 /tmp/templates_c/9a/9a08c87a91ae29fb4fb2354d1a59531e260d83b9164ca08a8225b44db2fc42e9.php(193): Twig\Template->displayBlock('root', Array, Array)\n#3 /vendor/twig/twig/src/Template.php(171): __TwigTemplate_5713bd1071680440c86898c36107f41e0cc8885e2e6b117f117112cb3d173905->block_body(Array, Array)\n#4 /vendor/twig/twig/src/Template.php(134): Twig\Template->displayBlock('body', Array, Array, false)\n#5 /tmp/templates_c/e6/e68b9b1c0d3eb0bcc91948372a47073c7df114067dde708b0b7c77abef8a0b2c.php(74): Twig\Template->displayParentBlock('body', Array, Array)\n#6 /vendor/twig/twig/src/Template.php(171): __TwigTemplate_cdb2cc63806c3af273367083c3a0ceba749eb89c89d6a5ec57ab9a842268f07e->block_body(Array, Array)\n#7 /tmp/templates_c/9a/9a08c87a91ae29fb4fb2354d1a59531e260d83b9164ca08a8225b44db2fc42e9.php(71): Twig\Template->displayBlock('body', Array, Array)\n#8 /vendor/twig/twig/src/Template.php(394): __TwigTemplate_5713bd1071680440c86898c36107f41e0cc8885e2e6b117f117112cb3d173905->doDisplay(Array, Array)\n#9 /vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)\n#10 /tmp/templates_c/e6/e68b9b1c0d3eb0bcc91948372a47073c7df114067dde708b0b7c77abef8a0b2c.php(55): Twig\Template->display(Array, Array)\n#11 /vendor/twig/twig/src/Template.php(394): __TwigTemplate_cdb2cc63806c3af273367083c3a0ceba749eb89c89d6a5ec57ab9a842268f07e->doDisplay(Array, Array)\n#12 /vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)\n#13 /tmp/templates_c/e8/e8b2ebf7b89bce3061d723261c1d19c36ebd4c27fc863a8737de4555aae00bf8.php(47): Twig\Template->display(Array, Array)\n#14 /vendor/twig/twig/src/Template.php(394): __TwigTemplate_b864a2bad82d18f9a0c90af479d66d44463760f20eef911c4e5c3edce2b7af17->doDisplay(Array, Array)\n#15 /vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)\n#16 /vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array)\n#17 /vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render(Array, Array)\n#18 /vendor/twig/twig/src/Environment.php(277): Twig\TemplateWrapper->render(Array)\n#19 /core/View.php(331): Twig\Environment->render('@UsersManager/u...', Array)\n#20 /core/View.php(316): Piwik\View->renderTwigTemplate()\n#21 /core/Plugin/Controller.php(330): Piwik\View->render()\n#22 /core/Plugin/Controller.php(285): Piwik\Plugin\Controller->renderTemplateAs('@UsersManager/u...', Array)\n#23 /plugins/UsersManager/Controller.php(299): Piwik\Plugin\Controller->renderTemplate('userSecurity', Array)\n#24 [internal function]: Piwik\Plugins\UsersManager\Controller->userSecurity()\n#25 /core/FrontController.php(631): call_user_func_array(Array, Array)\n#26 /core/FrontController.php(169): Piwik\FrontController->doDispatch('UsersManager', 'userSecurity', Array)\n#27 /core/dispatch.php(32): Piwik\FrontController->dispatch()\n#28 /index.php(25): require_once('/c...')\n#29 {main}\ncaused by: The parameter 'period' isn't set in the Request, and a default value wasn't provided. on /core/Common.php(513)\n#0 /core/Piwik.php(904): Piwik\Common::getRequestVar('period', NULL, 'string')\n#1 /core/Plugin/Controller.php(915): Piwik\Piwik::getPeriod()\n#2 /core/Plugin/Controller.php(618): Piwik\Plugin\Controller::setPeriodVariablesView(Object(Piwik\View))\n#3 /core/Plugin/Controller.php(319): Piwik\Plugin\Controller->setGeneralVariablesViewAs(Object(Piwik\View), 'basic')\n#4 /core/Plugin/Controller.php(285): Piwik\Plugin\Controller->renderTemplateAs('@TwoFactorAuth/...', Array)\n#5 /plugins/TwoFactorAuth/Controller.php(127): Piwik\Plugin\Controller->renderTemplate('userSettings', Array)\n#6 [internal function]: Piwik\Plugins\TwoFactorAuth\Controller->userSettings()\n#7 /core/FrontController.php(631): call_user_func_array(Array, Array)\n#8 /core/FrontController.php(169): Piwik\FrontController->doDispatch('TwoFactorAuth', 'userSettings', Array)\n#9 /plugins/TwoFactorAuth/TwoFactorAuth.php(94): Piwik\FrontController->dispatch('TwoFactorAuth', 'userSettings')\n#10 [internal function]: Piwik\Plugins\TwoFactorAuth\TwoFactorAuth->render2FaUserSettings('')\n#11 /core/EventDispatcher.php(141): call_user_func_array(Array, Array)\n#12 /core/Piwik.php(845): Piwik\EventDispatcher->postEvent('Template.userSe...', Array, false, Array)\n#13 /core/Twig.php(273): Piwik\Piwik::postEvent('Template.userSe...', Array)\n#14 /tmp/templates_c/e8/e8b2ebf7b89bce3061d723261c1d19c36ebd4c27fc863a8737de4555aae00bf8.php(155): Piwik\Twig->Piwik\{closure}('Template.userSe...')\n#15 /vendor/twig/twig/src/Template.php(171): __TwigTemplate_b864a2bad82d18f9a0c90af479d66d44463760f20eef911c4e5c3edce2b7af17->block_content(Array, Array)\n#16 /tmp/templates_c/e6/e68b9b1c0d3eb0bcc91948372a47073c7df114067dde708b0b7c77abef8a0b2c.php(157): Twig\Template->displayBlock('content', Array, Array)\n#17 /vendor/twig/twig/src/Template.php(171): __TwigTemplate_cdb2cc63806c3af273367083c3a0ceba749eb89c89d6a5ec57ab9a842268f07e->block_root(Array, Array)\n#18 /tmp/templates_c/9a/9a08c87a91ae29fb4fb2354d1a59531e260d83b9164ca08a8225b44db2fc42e9.php(193): Twig\Template->displayBlock('root', Array, Array)\n#19 /vendor/twig/twig/src/Template.php(171): __TwigTemplate_5713bd1071680440c86898c36107f41e0cc8885e2e6b117f117112cb3d173905->block_body(Array, Array)\n#20 /vendor/twig/twig/src/Template.php(134): Twig\Template->displayBlock('body', Array, Array, false)\n#21 /tmp/templates_c/e6/e68b9b1c0d3eb0bcc91948372a47073c7df114067dde708b0b7c77abef8a0b2c.php(74): Twig\Template->displayParentBlock('body', Array, Array)\n#22 /vendor/twig/twig/src/Template.php(171): __TwigTemplate_cdb2cc63806c3af273367083c3a0ceba749eb89c89d6a5ec57ab9a842268f07e->block_body(Array, Array)\n#23 /tmp/templates_c/9a/9a08c87a91ae29fb4fb2354d1a59531e260d83b9164ca08a8225b44db2fc42e9.php(71): Twig\Template->displayBlock('body', Array, Array)\n#24 /vendor/twig/twig/src/Template.php(394): __TwigTemplate_5713bd1071680440c86898c36107f41e0cc8885e2e6b117f117112cb3d173905->doDisplay(Array, Array)\n#25 /vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)\n#26 /tmp/templates_c/e6/e68b9b1c0d3eb0bcc91948372a47073c7df114067dde708b0b7c77abef8a0b2c.php(55): Twig\Template->display(Array, Array)\n#27 /vendor/twig/twig/src/Template.php(394): __TwigTemplate_cdb2cc63806c3af273367083c3a0ceba749eb89c89d6a5ec57ab9a842268f07e->doDisplay(Array, Array)\n#28 /vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)\n#29 /tmp/templates_c/e8/e8b2ebf7b89bce3061d723261c1d19c36ebd4c27fc863a8737de4555aae00bf8.php(47): Twig\Template->display(Array, Array)\n#30 /vendor/twig/twig/src/Template.php(394): __TwigTemplate_b864a2bad82d18f9a0c90af479d66d44463760f20eef911c4e5c3edce2b7af17->doDisplay(Array, Array)\n#31 /vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)\n#32 /vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array)\n#33 /vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render(Array, Array)\n#34 /vendor/twig/twig/src/Environment.php(277): Twig\TemplateWrapper->render(Array)\n#35 /core/View.php(331): Twig\Environment->render('@UsersManager/u...', Array)\n#36 /core/View.php(316): Piwik\View->renderTwigTemplate()\n#37 /core/Plugin/Controller.php(330): Piwik\View->render()\n#38 /core/Plugin/Controller.php(285): Piwik\Plugin\Controller->renderTemplateAs('@UsersManager/u...', Array)\n#39 /plugins/UsersManager/Controller.php(299): Piwik\Plugin\Controller->renderTemplate('userSecurity', Array)\n#40 [internal function]: Piwik\Plugins\UsersManager\Controller->userSecurity()\n#41 /core/FrontController.php(631): call_user_func_array(Array, Array)\n#42 /core/FrontController.php(169): Piwik\FrontController->doDispatch('UsersManager', 'userSecurity', Array)\n#43 /core/dispatch.php(32): Piwik\FrontController->dispatch()\n#44 /index.php(25): require_once('/c...')\n#45 {main}","safemode_backtrace":"#0 [internal function]: Piwik\Plugins\Cloud\Controller->safemode(Array)\n#1 /core/FrontController.php(631): call_user_func_array(Array, Array)\n#2 /core/FrontController.php(169): Piwik\FrontController->doDispatch('Cloud', 'safemode', Array)\n#3 /core/FrontController.php(100): Piwik\FrontController->dispatch('CorePluginsAdmi...', 'safemode', Array)\n#4 /core/FrontController.php(140): Piwik\FrontController::(Array)\n#5 /core/FrontController.php(184): Piwik\FrontController::(Object(Twig\Error\RuntimeError))\n#6 /core/dispatch.php(32): Piwik\FrontController->dispatch()\n#7 /index.php(25): require_once('/c...')\n#8 {main}"}

URL: /index.php?module=UsersManager&action=userSecurity&idSite=1

Referrer: /index.php?module=SearchEngineKeywordsPerformance&action=index&idSite=1

@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Sep 12, 2022
@peterhashair
Copy link
Contributor

@tsteur quickly did a PR for that.

@tsteur
Copy link
Member Author

tsteur commented Sep 18, 2022

fyi this error is happening every workday at least once

@peterhashair
Copy link
Contributor

peterhashair commented Sep 19, 2022

@tsteur I can think of 2 solutions here. Any suggestion?

  • Adding the default period and day value from the global config to the twig template will fix the error globally, but like @sgiehl suggests 'I think this shouldn't cause any regressions, but hard to say won't cause any regression, as it actually affects all parts of Matomo and any plugin'.

  • Adding redirect in the controller method when the period error shows.

 public function userSecurity()
     {
+        if(empty($_GET['period'])){
+            $this->redirectToIndex('UsersManager','userSecurity');
+        }
    

@tsteur
Copy link
Member Author

tsteur commented Sep 19, 2022

Adding the default period and day value from the global config to the twig template will fix the error globally,

That should do 👍 I don't think it should cause a regression either I would assume. Hard to say for sure though.

Maybe a problem be if someone disabled the day period in enabled_periods_API config or enabled_periods_UI but not adjusted the default period but don't even know if Matomo would work without the date period allowed.

@sgiehl sgiehl added this to the 4.12.0 milestone May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants