matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.87k stars 2.65k forks source link

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

Open tsteur opened 3 years ago

tsteur commented 3 years ago

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):

sgiehl commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

And a similar one

Error: {"message":"Call to undefined method Piwik\ProxyHttp::getName()","file":"vendor\/twig\/twig\/src\/ExtensionSet.php","line":397,"requestid":"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