Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-20558

CiviReport: Contribution Summary - groupBy split personality issue

    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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              arborrow Anthony Borrow
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: