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

Fatal Error addCategory() must be an instance of Piwik\\Cache, instance of ActionsCategory given #17881

Open
tsteur opened this issue Aug 12, 2021 · 3 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.

Comments

@tsteur
Copy link
Member

tsteur commented Aug 12, 2021

See below stack trace. Not sure how this would happen. Maybe some PHP bug. It's the latest PHP 7.4. I think I've seen this once before. I will comment when this happens again and put it for now into backlog so we won't work on it.

"Argument 1 passed to Piwik\Category\CategoryList::addCategory() must be an instance of Piwik\Cache, instance of Piwik\Plugins\CoreHome\Categories\ActionsCategory given, called in /core/Category/CategoryList.php on line 70","file":"/core/Category/CategoryList.php","line":26,"request_id":"3a688","backtrace":" on /core/Category/CategoryList.php(26)\n#0 /core/Category/CategoryList.php(70): Piwik\Category\CategoryList->addCategory(Object(Piwik\Plugins\CoreHome\Categories\ActionsCategory))\n#1 /plugins/CustomReports/Model/CustomReportsModel.php(200): Piwik\Category\CategoryList::get()\n#2 /plugins/CustomReports/Model/CustomReportsModel.php(221): Piwik\Plugins\CustomReports\Model\CustomReportsModel->getCategoryList()\n#3 /plugins/CustomReports/Model/CustomReportsModel.php(190): Piwik\Plugins\CustomReports\Model\CustomReportsModel->buildCategoryMetadata('General_Actions')\n#4 /plugins/CustomReports/Model/CustomReportsModel.php(170): Piwik\Plugins\CustomReports\Model\CustomReportsModel->enrichReport(Array, false)\n#5 /plugins/CustomReports/Model/CustomReportsModel.php(160): Piwik\Plugins\CustomReports\Model\CustomReportsModel->enrichReports(Array, false)\n#6 /plugins/CustomReports/API.php(233): Piwik\Plugins\CustomReports\Model\CustomReportsModel->getAllCustomReportsForSite('1', false)\n#7 [internal function]: Piwik\Plugins\CustomReports\API->getConfiguredReports('1', '0')\n#8 /core/API/Proxy.php(244): call_user_func_array(Array, Array)\n#9 /core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()\n#10 /core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))\n#11 /core/API/Request.php(266): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'getConfiguredRe...', Array)\n#12 /core/API/Request.php(559): Piwik\API\Request->process()\n#13 /plugins/CustomReports/CustomReports.php(366): Piwik\API\Request::processRequest('CustomReports.g...', Array, Array)\n#14 /plugins/CustomReports/CustomReports.php(197): Piwik\Plugins\CustomReports\CustomReports->getConfiguredReports(1)\n#15 [internal function]: Piwik\Plugins\CustomReports\CustomReports->addCustomReports(Array)\n#16 /core/EventDispatcher.php(141): call_user_func_array(Array, Array)\n#17 /core/Piwik.php(809):

@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Aug 12, 2021
@tsteur tsteur added this to the Backlog (Help wanted) milestone Aug 12, 2021
@sgiehl
Copy link
Member

sgiehl commented Aug 13, 2021

Argument 1 passed to Piwik\Category\CategoryList::addCategory() must be an instance of Piwik\Cache, instance of Piwik\Plugins\CoreHome\Categories\ActionsCategory given, called in /core/Category/CategoryList.php on line 70

That message doesn't make sense at all. The method is defined as:

    public function addCategory(Category $category)

So not sure why it complains about not being an instance of Piwik\Cache 🤷

@tsteur
Copy link
Member Author

tsteur commented Sep 22, 2021

Had now a similar random error with a different class. It must be some PHP bug

Error: {"message":"Argument 3 passed to Piwik\\Segment::__construct() must be an instance of Piwik\\Period\\PeriodValidator or null, instance of Piwik\\Date given, called in /core\/Archive\/ArchiveQueryFactory.php on line 128","file":"/core\/Segment.php","line":124,"request_id":"af6e1","backtrace":" on /core\/Segment.php(124)\n#0 /core\/Archive\/ArchiveQueryFactory.php(128): Piwik\\Segment->__construct(false, Array, Object(Piwik\\Date), Object(Piwik\\Date))\n#1 /core\/Archive\/ArchiveQueryFactory.php(32): Piwik\\Archive\\ArchiveQueryFactory->getSegmentFromQueryParam(false, Array, Array)\n#2 /core\/Archive.php(213): Piwik\\Archive\\ArchiveQueryFactory->build('1', 'day', '2021-09-07,2021...', false, false)\n#3 /plugins\/Goals\/API.php(531): Piwik\\Archive::build('1', 'day', '2021-09-07,2021...', false)\n#4 [internal function]: Piwik\\Plugins\\Goals\\API->getMetrics('1', 'day', '2021-09-07,2021...', false, 'ecommerceOrder', 'avg_order_reven...', '1')\n#5 /core\/API\/Proxy.php(244): call_user_func_array(Array, Array)\n#6 /core\/Context.php(28): Piwik\\API\\Proxy->Piwik\\API\\{closure}()\n#7 /core\/API\/Proxy.php(335): Piwik\\Context::executeWithQueryParameters(Array, Object(Closure))\n#8 /core\/API\/Request.php(266): Piwik\\API\\Proxy->call('\\\\Piwik\\\\Plugins\\\\...', 'getMetrics', Array)\n#9 /core\/API\/Request.php(559): Piwik\\API\\Request->process()\n#10 /plugins\/Goals\/API.php(491): Piwik\\API\\Request::processRequest('Goals.getMetric...', Array, Array)\n#11 [internal function]: Piwik\\Plugins\\Goals\\API->get('1', 'day', '2021-09-07,2021...', false, 'ecommerceOrder', 'avg_order_reven...', '1', false)\n#12 /core\/API\/Proxy.php(244): call_user_func_array(Array, Array)\n#13 /core\/Context.php(28): Piwik\\API\\Proxy->Piwik\\API\\{closure}()\n#14 /core\/API\/Proxy.php(335): Piwik\\Context::executeWithQueryParameters(Array, Object(Closure))\n#15 /core\/API\/Request.php(266): Piwik\\API\\Proxy->call('\\\\Piwik\\\\Plugins\\\\...', 'get', Array)\n#16 /core\/ViewDataTable\/Request.php(43): Piwik\\API\\Request->process()\n#17 /core\/Plugin\/ViewDataTable.php(368): Piwik\\ViewDataTable\\Request->loadDataTableFromAPI(Array)\n#18

@tsteur
Copy link
Member Author

tsteur commented Sep 27, 2021

And a similar one

Error: {"message":"Call to undefined method Piwik\ProxyHttp::getName()","file":"vendor/twig/twig/src/ExtensionSet.php","line":397,"request_id":"5f6ef","backtrace":" on vendor/twig/twig/src/ExtensionSet.php(397)\n#0 vendor/twig/twig/src/ExtensionSet.php(386): Twig\ExtensionSet->initExtension(Object(Twig\Extension\CoreExtension))\n#1 vendor/twig/twig/src/ExtensionSet.php(360): Twig\ExtensionSet->initExtensions()\n#2 vendor/twig/twig/src/Environment.php(794): Twig\ExtensionSet->getUnaryOperators()\n#3 vendor/twig/twig/src/Lexer.php(457): Twig\Environment->getUnaryOperators()\n#4 vendor/twig/twig/src/Lexer.php(108): Twig\Lexer->getOperatorRegex()\n#5 vendor/twig/twig/src/Environment.php(457): Twig\Lexer->__construct(Object(Twig\Environment))\n#6 vendor/twig/twig/src/Environment.php(507): Twig\Environment->tokenize(Object(Twig\Source))\n#7 vendor/twig/twig/src/Environment.php(348): Twig\Environment->compileSource(Object(Twig\Source))\n#8 vendor/twig/twig/src/Environment.php(309): Twig\Environment->loadTemplate('_TwigTemplate...', '@CustomPlugin/safemode...')\n#9 vendor/twig/twig/src/Environment.php(277): Twig\Environment->load('@CustomPlugin/safemode...')\n#10 core/View.php(318): Twig\Environment->render('@CustomPlugin/safemode...', Array)\n#11 core/View.php(303): Piwik\View->renderTwigTemplate()\n#12 plugins/CustomPlugin/Controller.php(316): Piwik\View->render()\n#13 [internal function]: Piwik\Plugins\CustomPlugin\Controller->safemode(Array)\n#14 core/FrontController.php(616): call_user_func_array(Array, Array)\n#15 core/FrontController.php(167): Piwik\FrontController->doDispatch('CustomPlugin', 'safemode', Array)\n#16 core/FrontController.php(98): Piwik\FrontController->dispatch('CorePluginsAdmi...', 'safemode', Array)\n#17 core/FrontController.php(138): Piwik\FrontController::generateSafeModeOutputFromError(Array)\n#18 core/FrontController.php(188): Piwik\FrontController::generateSafeModeOutputFromException(Object(Error))\n#19 core/FrontController.php(98): Piwik\FrontController->dispatch('CorePluginsAdmi...', 'safemode', Array)\n#20 core/FrontController.php(138): Piwik\FrontController::generateSafeModeOutputFromError(Array)\n#21 core/FrontController.php(188): Piwik\FrontController::generateSafeModeOutputFromException(Object(Error))\n#22 core/Plugin/Controller.php(975): Piwik\FrontController->dispatch('Login', false)\n#23 plugins/CoreHome/Controller.php(138): Piwik\Plugin\Controller->redirectToIndex('CoreHome', 'index', 0)\n#24 [internal function]: Piwik\Plugins\CoreHome\Controller->redirectToCoreHomeIndex()\n#25 core/FrontController.php(616): call_user_func_array(Array, Array)\n#26 core/FrontController.php(167): Piwik\FrontController->doDispatch('CoreHome', false, Array)\n#27 core/dispatch.php(32): Piwik\FrontController->dispatch()\n#28 index.php(25): require_once('c...')\n#29 {main}","safemode_backtrace":"#0 [internal function]: Piwik\Plugins\CustomPlugin\Controller->safemode(Array)\n#1 /core/FrontController.php(616): call_user_func_array(Array, Array)\n#2 /core/FrontController.php(167): Piwik\FrontController->doDispatch('CustomPlugin', 'safemode', Array)\n#3 /core/FrontController.php(98): Piwik\FrontController->dispatch('CorePluginsAdmi...', 'safemode', Array)\n#4 /core/FrontController.php(138): Piwik\FrontController::(Array)\n#5 /core/FrontController.php(188): Piwik\FrontController::(Object(Error))\n#6 /core/FrontController.php(98): Piwik\FrontController->dispatch('CorePluginsAdmi...', 'safemode', Array)\n#7 /core/FrontController.php(138): Piwik\FrontController::(Array)\n#8 /core/FrontController.php(188): Piwik\FrontController::(Object(Error))\n#9 /core/FrontController.php(98): Piwik\FrontController->dispatch('CorePluginsAdmi...', 'safemode', Array)\n#10 /core/FrontController.php(138): Piwik\FrontController::(Array)\n#11 /core/FrontController.php(188): Piwik\FrontController::(Object(Error))\n#12 /core/Plugin/Controller.php(975): Piwik\FrontController->dispatch('Login', false)\n#13 /plugins/CoreHome/Controller.php(138): Piwik\Plugin\Controller->redirectToIndex('CoreHome', 'index', 0)\n#14 [internal function]: Piwik\Plugins\CoreHome\Controller->redirectToCoreHomeIndex()\n#15 /core/FrontController.php(616): call_user_func_array(Array, Array)\n#16 /core/FrontController.php(167): Piwik\FrontController->doDispatch('CoreHome', false, Array)\n#17 /core/dispatch.php(32): Piwik\FrontController->dispatch()\n#18 /index.php(25): require_once('/c...')\n#19 {main}

image

it's trying to call ProxyHttp there

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

No branches or pull requests

2 participants