From 873272b80e98d14775a8e73c856e6da4183faa35 Mon Sep 17 00:00:00 2001 From: Pinga <121483313+getpinga@users.noreply.github.com> Date: Tue, 3 Dec 2024 12:41:22 +0200 Subject: [PATCH] Small warning fix in CP --- cp/app/Controllers/ReportsController.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cp/app/Controllers/ReportsController.php b/cp/app/Controllers/ReportsController.php index a5f7c77..0a7a7f3 100644 --- a/cp/app/Controllers/ReportsController.php +++ b/cp/app/Controllers/ReportsController.php @@ -73,16 +73,18 @@ class ReportsController extends Controller // Write the headers to the CSV file fputcsv($csvFile, $headers); - + // Write the domain data to the CSV file - foreach ($domains as $domain) { - fputcsv($csvFile, [ - $domain['name'], - $domain['crdate'], - $domain['exdate'] - ]); + if (!empty($domains) && is_iterable($domains)) { + foreach ($domains as $domain) { + fputcsv($csvFile, [ + $domain['name'], + $domain['crdate'], + $domain['exdate'] + ]); + } } - + // Rewind the file pointer to the beginning of the file fseek($csvFile, 0);