- Issue created by @jsutta
- Status changed to Postponed
over 1 year ago 12:30pm 18 July 2023 - 🇺🇦Ukraine Matroskeen 🇺🇦 Ukraine, Lutsk
I'm trying to understand how this is possible. The 2nd parameter of
array_map
call is$entity_types
, which containsenabled_entity_types
property ofrabbit_hole.settings
config.There is a default value for this property defined in
config/install/rabbit_hole.settings.yml
. So how did you manage to install the module without applying the default configuration?Can you check please?
- Status changed to Postponed: needs info
over 1 year ago 12:41pm 18 July 2023 - 🇺🇦Ukraine taraskorpach Lutsk
I got the same error while upgrading to D10.1.1. Fortunately, the error is fixed by running a database update. Therefore, the patch is not useful.
- 🇺🇸United States jsutta United States
Agreed. I removed the patch and my site's working just fine. Most likely just user error on my part. We can close this issue.
- Status changed to Closed: cannot reproduce
over 1 year ago 11:02am 3 August 2023 - 🇺🇦Ukraine Matroskeen 🇺🇦 Ukraine, Lutsk
Thanks for the confirmation! Closing it
- 🇩🇪Germany DiDebru
I got this error after upgrading from 9.4 to 10.1.
I did run all db updates and ended up with an empty setting en/admin/config/content/rabbit-hole and the variable was always null.
The patch did not solve this but I was able to solve this by overriding the variable with an empty array than I did the config saved removed the workaround and my site works again. - 🇮🇳India aadeshvermaster@gmail.com
I got this error after upgrading from Drupal 9 to 10. After applying Patch https://www.drupal.org/project/rabbit_hole/issues/3375025#comment-15152836 🐛 TypeError: array_map(): Argument #2 ($array) must be of type array, null given in array_map() Closed: cannot reproduce its resolved this error
- 🇭🇺Hungary denes.szabo Hungary
I got this error also, fresh 10.2.3.
The problem is: The code suppose the $entity_types is array. It is not if you have not setup the module, its NULL.
Then the array_map tries to use it as an array.
$entity_types = \Drupal::config('rabbit_hole.settings')->get('enabled_entity_types') ?? []; $affected_bundle_types = array_map(function($entity_type_id) use ($entity_type_manager) { return $entity_type_manager->getStorage($entity_type_id)->getEntityType()->getBundleEntityType(); }, $entity_types);
Quick solution is: $entity_types = \Drupal::config('rabbit_hole.settings')->get('enabled_entity_types') ?? [];
Same error exists in the src/BehaviorSettingsManager. But there it has been handled similar way alreay in the line 41.
Patch to fix these issues is attached.
- Status changed to Needs work
10 months ago 11:30am 10 February 2024 - 🇺🇦Ukraine Matroskeen 🇺🇦 Ukraine, Lutsk
The problem is: The code suppose the $entity_types is array. It is not if you have not setup the module, its NULL
I wonder how the module hook implementation is being called if the module is not installed?
- 🇭🇺Hungary denes.szabo Hungary
@Matroskeen
I mean: The rabbit_hole already installed but not configured - the config is empty, the rabbit hole settings form was not submitted - or there was no entity type checked.
I do not know why sb want this situation, enable the rb, but does not configure it properly, but on my (inherited) site this is the status.
Whatever: if this config should used in array environment, then it should be an array.
The empty value default set to array case was already there (I mentioned it before) I just added the default array value to all similar code.
- 🇳🇱Netherlands K3vin_nl
Just want to confirm that #2 3375025-2.patch fixed the issue for us.