Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7.20
-
Fix Version/s: 4.7.20
-
Component/s: CiviReport
-
Labels:
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Needs Funding
-
Verified?:No
Description
Under PHP 7.1, when running the Contribution Summary report I received:
Error: [] operator not supported for strings in CRM_Report_Form_Contribute_Summary->groupBy() (line 580 of /home/anthony/buildkit/build/devtraining/sites/all/modules/civicrm/CRM/Report/Form/Contribute/Summary.php).
In looking at the groupBy() function, it is initialized as a string but later assigned as if it were an array in:
$this->_groupBy[] = self::fiscalYearOffset($field['dbAlias']);
later on it is deconstructed and reconstructed:
$groupBy = array();
foreach ($this->_groupBy as $key => $val) {
if (strpos($val, ';;') !== FALSE) {
$groupBy = array_merge($groupBy, explode(';;', $val));
}
else {
$groupBy[] = $this->_groupBy[$key];
}
}
Can someone work to rework this so that it is less confusing and more consistent so that it will work in PHP 7.1.