@@ -425,6 +425,7 @@ public function get(
425425 'hideMetricsDoc ' => false ,
426426 'idSubtable ' => $ idSubtable ,
427427 'showRawMetrics ' => false ,
428+ 'format_metrics ' => 0 ,
428429 ];
429430 /** @var array $processedReport */
430431 $ processedReport = Request::processRequest ('API.getProcessedReport ' , $ parameters );
@@ -470,8 +471,7 @@ public function get(
470471 }
471472 $ i ++;
472473 }
473- } else // if the report has no dimension we have multiple reports each with only one row within the reportData
474- {
474+ } else { // if the report has no dimension we have multiple reports each with only one row within the reportData
475475 /** @var DataTable[] $periodsData */
476476 $ periodsData = array_values ($ reportData ->getDataTables ());
477477 $ periodsCount = count ($ periodsData );
@@ -592,9 +592,13 @@ private function setFilterTruncate(int $default): void
592592 $ _GET ['filter_truncate ' ] = PiwikRequest::fromRequest ()->getIntegerParameter ('filter_truncate ' , $ default );
593593 }
594594
595- private static function parseOrdinateValue ($ ordinateValue )
595+ private static function parseOrdinateValue ($ ordinateValue ): float
596596 {
597- $ ordinateValue = @str_replace (', ' , '. ' , $ ordinateValue );
597+ if (is_int ($ ordinateValue ) || is_float ($ ordinateValue )) {
598+ return (float ) $ ordinateValue ;
599+ }
600+
601+ $ ordinateValue = @str_replace (', ' , '. ' , (string ) $ ordinateValue );
598602
599603 // convert hh:mm:ss formatted time values to number of seconds
600604 if (preg_match ('/([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\.[0-9]{2})?)/ ' , $ ordinateValue , $ matches )) {
@@ -606,7 +610,13 @@ private static function parseOrdinateValue($ordinateValue)
606610 }
607611
608612 // OK, only numbers from here please (strip out currency sign)
609- return preg_replace ('/[^0-9.]/ ' , '' , $ ordinateValue );
613+ $ ordinateValue = preg_replace ('/[^0-9.]/ ' , '' , $ ordinateValue );
614+
615+ if ($ ordinateValue === null || $ ordinateValue === '' || $ ordinateValue === '. ' ) {
616+ return 0.0 ;
617+ }
618+
619+ return is_numeric ($ ordinateValue ) ? (float ) $ ordinateValue : 0.0 ;
610620 }
611621
612622 private static function getFontPath (string $ font ): string
0 commit comments