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?