2

Summary:

Error in Drupal permissions page (admin/people/permissions/module/civicrm) after fresh install of CiviCRM 5.74.4:

InvalidArgumentException: "0" is an invalid render array key. Value should be an array but got a string. in Drupal\Core\Render\Element::children() (line 97 of core/lib/Drupal/Core/Render/Element.php).

Details:

I have a fresh installation of Drupal 10.3.0 with PHP 8.2.20 on ddev v1.23.3. Only default core modules are enabled. No custom modules. I followed all the instructions on https://docs.civicrm.org/installation/en/latest/drupal/#drupal10-download to "Get the code for Drupal 10".

In WSL2, I did this to add the latest CiviCRM version to D10:

  cd ~proj/websitename
  ddev composer require civicrm/civicrm-{core,packages,drupal-8}
  ddev composer require civicrm/cli-tools

This worked perfectly. Two modules were installed, but not yet enabled: civicrm and civicrmtheme.

Next, in order to enable both modules:

  ddev ssh

and then, in directory /var/www/html$,

  cv core:install --cms-base-url=https://websitename.ddev.site/

This works almost perfectly. All CiviCRM functionalities seem to work. All Drupal functionalities work as well, except for one: https://websitename.ddev.site/admin/people/permissions/module/civicrm. This page shows the following error:

InvalidArgumentException: "0" is an invalid render array key. Value should be an array but got a string. in Drupal\Core\Render\Element::children() (line 97 of core/lib/Drupal/Core/Render/Element.php).

and a lot of lines of code which I can provide if necessary.

The error doesn't show up with any of the other modules. It does also show up however with https://websitename.ddev.site/admin/people/permissions. Before cv core: install, this error didn't show up.

What I have tried:

line 82 to 98 of core/lib/Drupal/Core/Render/Element.php contain the following code:

82 if (is_array($value)) {
     ...
93 }
94 // comment
95 // comment
96 elseif (isset($value)) {
97   throw new \InvalidArgumentException(sprintf('"%s" is an invalid render array key. Value should be an array but got a %s.', $key, gettype($value)));
98 }

When line 97 is commented out, the problem disappears. This is obviously not the final solution. I guess the cause of the problem lies in the code for which is_array($value) is false. I suppose this occurs somewhere in the civicrm code. Unfortunatly I am unable to track it down.

Can someone offer some help or guidance please?

1
  • 1
    I'm seeing the same error on a D10/Civi site that I've just updated to the same versions: Drupal 10.3 and Civi 5.74.4. The site seems to work, although I get a fatal error at admin/people/permissions. I've spent the last couple of days trying to track this down as a Drupal error without success, so knowing that it is being triggered by CiviCRM is a step forward.
    – Graham
    Commented Jul 3 at 10:04

1 Answer 1

2

This is fixed in https://github.com/civicrm/civicrm-drupal-8/pull/94.

5.74 backport at https://github.com/civicrm/civicrm-drupal-8/pull/96

2
  • Many thanks. That works for me.
    – Graham
    Commented Jul 3 at 11:10
  • This gets my permissions page back to functional. Many thanks.
    – remonds
    Commented Jul 3 at 14:31

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.