@tsteur opened this Issue on September 12th 2022 Member

Seeing this error on Cloud

Error: {"message":"Piwik\Metrics\Formatter::getMetricsToFormat(): Argument #1 ($dataTable) must be of type Piwik\DataTable, Piwik\DataTable\Simple given, called in core\/Metrics\/Formatter.php on line 177","file":"core\/Metrics\/Formatter.php","line":284,"request_id":"20095","backtrace":" on core\/Metrics\/Formatter.php(284)\n#0 core\/Metrics\/Formatter.php(177): Piwik\Metrics\Formatter->getMetricsToFormat(Object(Piwik\DataTable\Simple), Object(Piwik\Plugins\Referrers\Reports\Get))\n#1 [internal function]: Piwik\Metrics\Formatter->formatMetrics(Object(Piwik\DataTable\Simple), Object(Piwik\Plugins\Referrers\Reports\Get), Array, false)\n#2 core\/DataTable.php(511): call_user_func_array(Array, Array)\n#3 core\/DataTable\/Map.php(109): Piwik\DataTable->filter(Array, Array)\n#4 core\/API\/DataTablePostProcessor.php(396): Piwik\DataTable\Map->filter(Array, Array)\n#5 core\/API\/DataTablePostProcessor.php(137): Piwik\API\DataTablePostProcessor->applyMetricsFormatting(Object(Piwik\DataTable\Map))\n#6 core\/API\/ResponseBuilder.php(190): Piwik\API\DataTablePostProcessor->process(Object(Piwik\DataTable\Map))\n#7 core\/API\/ResponseBuilder.php(104): Piwik\API\ResponseBuilder->handleDataTable(Object(Piwik\DataTable\Map))\n#8 core\/API\/Request.php(272): Piwik\API\ResponseBuilder->getResponse(Object(Piwik\DataTable\Map), 'Referrers', 'get')\n#9 core\/Context.php(28): Piwik\API\Request->Piwik\API\{closure}()\n#10 core\/API\/Request.php(273): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))\n#11 core\/ViewDataTable\/Request.php(45): Piwik\API\Request->process()\n#12 core\/Plugin\/ViewDataTable.php(368): Piwik\ViewDataTable\Request->loadDataTableFromAPI(Array)\n#13 plugins\/CoreVisualizations\/Visualizations\/Sparkline.php(52): Piwik\Plugin\ViewDataTable->loadDataTableFromAPI()\n#14 core\/Plugin\/Report.php(320): Piwik\Plugins\CoreVisualizations\Visualizations\Sparkline->render()\n#15 plugins\/CoreHome\/Controller.php(60): Piwik\Plugin\Report->render()\n#16 [internal function]: Piwik\Plugins\CoreHome\Controller->renderReportWidget(Object(Piwik\Plugins\Referrers\Reports\Get))\n#17 core\/FrontController.php(631): call_user_func_array(Array, Array)\n#18 core\/FrontController.php(169): Piwik\FrontController->doDispatch('Referrers', 'get', Array)\n#19 core\/dispatch.php(32): Piwik\FrontController->dispatch()\n#20 index.php(25): require_once('c...')\n#21 {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(190): Piwik\FrontController::(Object(TypeError))\n#6 \/core\/dispatch.php(32): Piwik\FrontController->dispatch()\n#7 \/index.php(25): require_once('\/c...')\n#8 {main}"}

URL: /index.php?date=2022-08-13,2022-09-11&module=Referrers&format=html&forceView=1&viewDataTable=sparkline&action=get&idSite=1&period=day&segment=&widget=&showtitle=1&random=5978&columns=Referrers_distinctSocialNetworks&colors=%7B%22backgroundColor%22%3A%22%23ffffff%22%2C%22lineColor%22%3A%22%23162c4a%22%2C%22minPointColor%22%3A%22%23ff7f7f%22%2C%22maxPointColor%22%3A%22%2375bf7c%22%2C%22lastPointColor%22%3A%22%2355aaff%22%2C%22fillColor%22%3A%22%23ffffff%22%7D

Referrer: /index.php?module=CoreHome&action=index&idSite=1&period=day&date=yesterday

@sgiehl commented on September 13th 2022 Member

This one looks a bit weird. Piwik\DataTable\Simple extends Piwik\DataTable, so it should also fulfill the type hint of the method 🧐
Does that happen often and is it reproducible?

Powered by GitHub Issue Mirror