Problem/Motivation
Pulled from original post
So far, it was always a property inside a views filter, where it expects value to be a string but it's an array.
Pulled from #44
This is specific to views because views defines generic default schema for certain things, like filter plugin values. The config schema system can handle missing config schema, what it can't deal with is mismatches where it's expecting a scalar but actually receives a mapping/array/complex data
Steps to reproduce
Generate a mismatch config schema and try to save it.
Proposed resolution
In the save function for Config.php wrap the code that attempts castValue() in a try/catch block. And loop through the data vs calling it as is.
Log issues vs throw error
Remaining tasks
Update issue summary
User interface changes
NA
API changes
NA
Data model changes
NA
Release notes snippet
NA
Original Post
I had multiple 8.4 upgrades failing with an error like this so far:
#0 Drupal\Core\Config\Schema\ArrayElement->get() called at [/core/lib/Drupal/Core/Config/StorableConfigBase.php:179]
#1 Drupal\Core\Config\StorableConfigBase->castValue() called at [/core/lib/Drupal/Core/Config/StorableConfigBase.php:211]
#2 Drupal\Core\Config\StorableConfigBase->castValue() called at [/core/lib/Drupal/Core/Config/StorableConfigBase.php:211]
#3 Drupal\Core\Config\StorableConfigBase->castValue() called at [/core/lib/Drupal/Core/Config/StorableConfigBase.php:211]
#4 Drupal\Core\Config\StorableConfigBase->castValue() called at [/core/lib/Drupal/Core/Config/StorableConfigBase.php:211]
#5 Drupal\Core\Config\StorableConfigBase->castValue() called at [/core/lib/Drupal/Core/Config/StorableConfigBase.php:211]
#6 Drupal\Core\Config\StorableConfigBase->castValue() called at [/core/lib/Drupal/Core/Config/StorableConfigBase.php:211]
#7 Drupal\Core\Config\StorableConfigBase->castValue() called at [/core/lib/Drupal/Core/Config/Config.php:212]
#8 Drupal\Core\Config\Config->save() called at [/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:280]
#9 Drupal\Core\Config\Entity\ConfigEntityStorage->doSave() called at [/core/lib/Drupal/Core/Entity/EntityStorageBase.php:392]
#10 Drupal\Core\Entity\EntityStorageBase->save() called at [/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:259]
#11 Drupal\Core\Config\Entity\ConfigEntityStorage->save() called at [/core/lib/Drupal/Core/Entity/Entity.php:377]
#12 Drupal\Core\Entity\Entity->save() called at [/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:637]
#13 Drupal\Core\Config\Entity\ConfigEntityBase->save() called at [/core/modules/views/views.post_update.php:213]
#14 {closure}()
#15 array_walk() called at [/core/modules/views/views.post_update.php:214]
#16 views_post_update_revision_metadata_fields() called at [/core/includes/update.inc:241]
#17 update_invoke_post_update() called at [/vendor/drush/drush/commands/core/drupal/batch.inc:163]
#18 _drush_batch_worker() called at [/vendor/drush/drush/commands/core/drupal/batch.inc:111]
#19 _drush_batch_command() called at [/vendor/drush/drush/includes/batch.inc:98]
#20 drush_batch_command() called at [/vendor/drush/drush/commands/core/drupal/update.inc:193]
So far, it was always a property inside a views filter, where it expects value to be a string but it's an array.
While it's bad that those mismatches exists, we ignore missing schema outside of tests, so I think we should also ignore those kind of problems, possibly just log them, without failing the update.
Example errors:
InvalidArgumentException: The configuration property display.default.display_options.filters.type.value.audio doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 of /h
InvalidArgumentException: The configuration property display.default.display_options.filters.type_1.value.image doesn't exist.