diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php index d3e76f951d8..420a52a88ac 100644 --- a/plugins/Goals/Goals.php +++ b/plugins/Goals/Goals.php @@ -310,7 +310,7 @@ public function getReportMetadataEnd(&$reports, $info) $reportsWithGoals = self::getAllReportsWithGoalMetrics(); - foreach ($reports as &$apiReportToUpdate) { + foreach ($reports as $index => &$apiReportToUpdate) { $reportHasGoals = false; foreach ($reportsWithGoals as $reportWithGoals) { if ( @@ -327,6 +327,10 @@ public function getReportMetadataEnd(&$reports, $info) continue; } + if (empty($apiReportToUpdate)) { // TODO: remove after done debugging + throw new \Exception("found empty report at $index"); + } + // collect extra metrics and processed metrics $extraProcessedMetrics = [ new \Piwik\Plugins\Goals\Columns\Metrics\RevenuePerVisit($allIdGoals),