From recrit #19 in #2851035: FeaturesConfigInstaller missing ConfigInstaller $install_profile argument on core 8.3.x:

I'm getting the following error with Features 3.3, Drupal 8.2.6, and an install profile set.

Argument 6 passed to Drupal\Core\Config\ConfigInstaller::__construct() must implement interface Drupal\Core\Extension\ProfileHandlerInterface, string given, called in                         [error]
../modules/contrib/features/src/FeaturesConfigInstaller.php on line 64 and defined ConfigInstaller.php:87

From the code in the FeaturesConfigInstaller, it looks like the issue is with $install_profile = drupal_get_profile();. In 8.2.x this function returns a string per https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/functi....
However, in 8.3.x this function could return a profile handler object even though the doc does not state that - https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/functi...

Note:
This error occurs due to the subprofile patch at #1356276: Allow profiles to define a base/parent profile.

Comments

mpotter created an issue. See original summary.

mpotter’s picture

Status: Active » Needs review
StatusFileSize
new1.32 KB

This error occurs because the inherited profile patch adds a ProfileHandler argument to the ConfigInstaller interface. But the ConfigInstaller interface is also different between Drupal 8.2 and 8.3. So rather than just passing the %install_profile% argument, we need to actually test which version of the interface we have. Here is a patch to try.

mpotter’s picture

FYI, drupal_get_profile() still returns a string, not a ProfileHandler, so docs are accurate. The issue was that when you add the inherited profile patch ConfigInstaller is expecting a ProfileHandler object (normally passed via the service container as dependency injection), but in Features 8.3 we were passing the string install_profile name. It was a case of incompatible interfaces. The reason commenting out the drupal_get_profile() works is that it passes a NULL value which is accepted by either interface.

There is a different inherited profile patch for D8.2 and D8.3 that handles this, but Features wasn't able to handle the changes in interface, thus added the version checking, which I hate to do but see no alternative to maintain compatibility.

(The downside of trying to extend core services like this)

  • mpotter committed 0328de8 on 8.x-3.x
    Issue #2855489 by mpotter: ConfigInstaller interface error with Features...
mpotter’s picture

Status: Needs review » Fixed

Committed to 0328de8.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.