Topic: report_classes.inc - Parameter must be an array

I'm getting the following message in Reports and Analysis with code version 2.4.4 (de943e150d36f815a02d4996e532a5e4e7510bc8) and PHP 7.2.3 (XAMPP 2018-03-14) with debugging on.

count(): Parameter must be an array or an object that implements Countable in file: D:\Users\shipl\htdocs\fa24\reporting\includes\reports_classes.inc at line 37
d:\Users\shipl\htdocs\fa24\reporting\reports_main.php:34:     (BoxReports Object)->addReportClass('Customer','0')

It seems that the issue is an uncorrected old style class constructor (probably missed as it has been renamed).

I propose the following change to fix the issue.

------------------------------------------------
reporting/includes/reports_classes.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc
index c872cef0..96134f95 100644
--- a/reporting/includes/reports_classes.inc
+++ b/reporting/includes/reports_classes.inc
@@ -26,7 +26,7 @@ class BoxReports
    var $ar_reports;
    var $ctrl_handlers = array();

-    function ReportClasses()
+    function __construct()
    {
        $this->ar_classes = array();
    }
------------------------------------------------

Thanks.

Re: report_classes.inc - Parameter must be an array

Hello,

This is strange, because this is not a constructor. Will try to examine this.

/Joe

Re: report_classes.inc - Parameter must be an array

Ah, I see. This is the only place where the variable ar_classes is declared as an array.

Your solution will fix this issue elegantly.

Committed.

/Joe

Re: report_classes.inc - Parameter must be an array

Great. Thanks Joe. Glad to help.