Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295724

Call to a member function getSettings() on null in FieldConfigBase

$
0
0

Problem

I have upgraded drupal from 10.1.8 to 10.2.6 and there is no change in existing config but still getting runtime exception getSettings() function error for base_field_override config. Please find screenshot for same. During sync process, I am getting below error

Error: Call to a member function getSettings() on null in Drupal\Core\Field\FieldConfigBase->getSettings() (line 374 of FieldConfigBase.php)

Steps to reproduce

  1. Update core from drupal 10.1.8 to 10.2.6
  2. Run Drush updb and drush cex
  3. in site build, config impoert is breaking due call to a member function getSettings() on null.

I have compared drupal core (core/lib/Drupal/Core/Field/) FieldConfigBase.php file for version 10.1.8 and 10.2.6. I can see the below difference in code.

// Make sure all expected runtime settings are present.
$default_settings = \Drupal::service('plugin.manager.field.field_type')
->getDefaultFieldSettings($this->getType());
// Filter out any unknown (unsupported) settings.
$supported_settings = array_intersect_key($this->getSettings(), $default_settings);
$this->set('settings', $supported_settings + $default_settings);

https://git.drupalcode.org/project/drupal/-/blob/10.1.8/core/lib/Drupal/...
https://git.drupalcode.org/project/drupal/-/blob/10.2.6/core/lib/Drupal/...

Above code added newly in 10.2.6 version which is not allowing import for base_field_override field config. It doesn't ahhave any backward compatiability issue for 10.1.8 core. 10.2.6 code changes are done as part of this issue for Field [storage] config have incomplete settings until they are saved ( https://www.drupal.org/project/drupal/issues/2327883)

Proposed resolution
If $this->getSettings() is not defined or not available it should be handled.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 295724

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>