I'm using Drupal 8 / Civi 5.11

I get the following errors on the screen multiple times (one for each Drupal role in my system) when I attempt to create a new report in CiviCRM (CiviCRM->Admin->CiviReports->Create New Report From Template -- using Constituent Summary, for example):

Warning: Illegal offset type in CRM_Report_Form_Instance::buildForm() (line 135 of /var/www/site/vendor/civicrm/civicrm-core/CRM/Report/Form/Instance.php).

It appears that on line 135, the Drupal roles are being iterated and assumed to be strings. They are, in fact, objects in Drupal 8.

Does anyone know if this is a bug already reported/being work on? I've looked at the issue queue but haven't turned anything up.

Is my system, perhaps, just misconfigured and it's not a bug after all?

1 Answer 1


Its a bug in CiviCRM and is not handled properly for D8, you can fix this by applying below patch

diff --git a/CRM/Report/Form/Instance.php b/CRM/Report/Form/Instance.php
index 8f00408a17..965949e21c 100644
--- a/CRM/Report/Form/Instance.php
+++ b/CRM/Report/Form/Instance.php
@@ -112,7 +112,13 @@ class CRM_Report_Form_Instance {
     if (function_exists('user_roles')) {
       $user_roles_array = user_roles();
       foreach ($user_roles_array as $key => $value) {
-        $user_roles[$value] = $value;
+        if (is_object($value) && is_a($value, 'Drupal\user\Entity\Role')) {
+          $value = $value->label();
+        }
+        else {
+          $key = $value;
+        }
+        $user_roles[$key] = $value;
       $grouprole = $form->addElement('advmultiselect',

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.