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:87From 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.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | features_configinstaller-2855489-2.patch | 1.32 KB | mpotter |
Comments
Comment #2
mpotter commentedThis 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.
Comment #3
mpotter commentedFYI, 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)
Comment #5
mpotter commentedCommitted to 0328de8.