Getting this warning when running `drush cim` in Drupal 9 ... seems this line in content_lock.module is evaluating to NULL:
$types = \Drupal::configFactory()->get('content_lock.settings')->get('types');
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install content_lock.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install datalayer.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install libraries.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install queue_ui.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install update.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install views_ui.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install admin_toolbar_search.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install feeds.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install feeds_ex.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install tamper.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install feeds_tamper.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install migrate_source_csv.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install migrate_source_ui.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install remote_stream_wrapper.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install d8unsw_cs.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install d8unsw_cs_utilities.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install d8unsw_cs_buildings_rooms.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install d8unsw_cs_events.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install d8unsw_cs_newsroom_news.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
[notice] Synchronized extensions: install d8unsw_cs_resgate_utilities.
[warning] array_filter() expects parameter 1 to be array, null given content_lock.module:238
[warning] Invalid argument supplied for foreach() content_lock.module:238
| Comment | File | Size | Author |
|---|
Issue fork content_lock-3243486
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
mohit.bansal623 commentedPlease review the merge request.
Comment #5
jaydee1818 commentedThis patch performs checks before executing foreach.
Comment #6
mohit.bansal623 commented@jaydee Moving it to Needs review as the merge request is already created and passed.
Comment #7
jaydee1818 commentedNo worries - looks good. I just made a slight change to check that $definition is set. I also need a patch for my project, so here it is.
Comment #8
jcisio commentedI'm not sure if it is a bug. I think you updated to the latest version, but did not export the new config, instead you imported the old config (or maybe empty one).
This patch simply hides a bug (and potentially makes it worse).
Comment #9
capysara commentedI'm having the same issue. Everything was fine on my local, all my config was exported, no errors, but then I deployed to my dev environment and hit the errors listed above.
Update: I was able to use the patch successfully. It applied cleanly and allowed me to deploy code without any database errors. I'm not sure if this is the best way to address the issue (if there are deeper issues), but checking the settings for the entity type first seems harmless.
Comment #10
donquixote commentedThe site should not completely crash if some config is not as expected or incomplete.
I don't even think we have an update hook that would introduce the 'types' setting.
I can't even go to a config page that would fix the problem.
Comment #11
harivenuvThanks for patch, #7 worked
Comment #12
idebr commentedAttached patch adds a type hint when loading the $types variable. This is harmless for 'correct' configuration, but will prevent 'invalid' configuration from triggering PHP errors.
Comment #13
saschaeggi#7 worked for me
Comment #14
simeNumber 12 is a should be
$types = (array) ...instead of(array) $types = ...Edit: Oh i see it's a hint.
Comment #15
yovanny.gomez.oyola commentedI'm agree whit @sime. Path number 12 does not work for me with PHP 8.1.
I add the patch with the adjustment.
Comment #16
smustgrave commentedTried replicating in D10 but I'm not getting an errors or warning when running drush cim. Anyone still experiencing this?
Comment #17
smustgrave commentedComment #19
astonvictor commentedComment #20
astonvictor commentedI was not able to reproduce it with 8.x and 3.x branches. Seems like there was a custom code that cleared values in the config.
anyway, added a simple fix.
thanks all for the support