Problem/Motivation

PHP Fatal error: Declaration of Drupal\features\FeaturesConfigInstaller::findPreExistingConfiguration(Drupal\Core\Config\StorageInterface $storage) must be compatible with Drupal\Core\Config\ConfigInstaller::findPreExistingConfiguration(Drupal\Core\Config\StorageInterface $storage, array $previous_config_names = []) in modules/contrib/features/src/FeaturesConfigInstaller.php on line 67

This happens because `ConfigInstaller::findPreExistingConfiguration()` in core was updated in [Drupal 11.2.0](https://www.drupal.org/project/drupal/releases/11.2.0) to include a new second parameter:
```php
array $previous_config_names = []
The override in Features does not match this updated method signature, causing a fatal error.

When using the Features module with Drupal 11.2.x and higher, the following fatal error occurs when running `drush updb` or similar config-installing operations:

Proposed resolution

Update the method signature in FeaturesConfigInstaller to match Drupal core:

- protected function findPreExistingConfiguration(StorageInterface $storage)
+ protected function findPreExistingConfiguration(StorageInterface $storage, array $previous_config_names = [])

Attached is a simple patch that updates the method signature.

Manually tested on Drupal 11.2.2
Confirmed fix for drush updb
Compatible with existing functionality

Issue fork features-3536095

Command icon 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

jbowm2 created an issue. See original summary.

jonasanne’s picture

Status: Needs review » Reviewed & tested by the community

I also tested this on 11.2.2 and can confirm it works.
Thanks

jonasanne’s picture

Converted the patch into a MR.

mark_fullmer’s picture

Noting that this change is already accounted for in the issue for Drupal 11 compatibility, per https://git.drupalcode.org/project/features/-/merge_requests/39#note_494953 . So, presumably, this issue can be closed in favor of the comprehensive changes in #3447460: Drupal 11 compatibility for Features module

bkosborne’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
Related issues: +#3447460: Drupal 11 compatibility for Features module

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.