With the removal of $settings['install_profile'] in 8.3.x, the install profile now needs to be passed to as the 6th parameter to ConfigInstaller::__construct(), which was not necessary previously. This causes errors when enabling Features on 8.3.x.
To be precise, this is the error -

Missing argument 6 for Drupal\Core\Config\ConfigInstaller::__construct(), called in [warning]
/web/modules/contrib/features/src/FeaturesConfigInstaller.php on line 56 and defined ConfigInstaller.php:85

Comments

fgm created an issue. See original summary.

fgm’s picture

Status: Active » Needs review
StatusFileSize
new1.7 KB

Let's see how this would fare.

kgoel’s picture

Issue summary: View changes
kgoel’s picture

install_profile change breaks things in lots of places. For example - ran the features test suite and saw some errors

Drupal\Tests\features\Unit\FeaturesManagerTest::testPrepareFiles
Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container.
Drupal\Tests\features\Unit\FeaturesManagerTest::testImport
Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container.
Drupal\Tests\features\Unit\FeaturesManagerTest::testGetExportInfoWithBundle
Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container.

Status: Needs review » Needs work

The last submitted patch, 2: 2851035-install_profile.patch, failed testing.

br0ken’s picture

Status: Needs work » Needs review
StatusFileSize
new2.14 KB
new2.01 KB

That's how it should be, IMO.

fgm’s picture

I think this won't work on core 8.2 where install profile is a setting, not a container parameter.

br0ken’s picture

Also this is blocker for https://www.drupal.org/pift-ci-job/596698

An issue created for 8.x-3.x-dev. Let's have problem resolved for this branch and then will do a backport.

br0ken’s picture

Stop, I was wrong. Ignore me. You meant that Features 8.3 should be compatible with core 8.2 as well. Now I've got it.

br0ken’s picture

@fgm, then your fix is better!

Status: Needs review » Needs work

The last submitted patch, 6: features-config_installer_install_profile-2851035-6.patch, failed testing.

br0ken’s picture

Status: Needs work » Needs review
StatusFileSize
new3.03 KB
new1.73 KB

This should fix the tests.

br0ken’s picture

StatusFileSize
new3.41 KB
new1.37 KB

Added some explanations as comments to code.

nedjo’s picture

Thanks all, this looks good, I'll wait for the tests to run and then apply it.

br0ken’s picture

@nedjo, do you have an idea why tests fails on PHP 5.6?

nedjo’s picture

Status: Needs review » Reviewed & tested by the community

@nedjo, do you have an idea why tests fails on PHP 5.6?

No. I actually can't make out what the test results mean.

Still, I'm tempted to apply this as is as at least a step in the right direction.

@mpotter: what do you think?

  • mpotter committed ee9ff35 on 8.x-3.x authored by BR0kEN
    Issue #2851035 by BR0kEN, fgm, kgoel, mpotter: FeaturesConfigInstaller...
mpotter’s picture

Status: Reviewed & tested by the community » Fixed

OK, I think this patch is a good step forward. The testbot is complicated and hard to debug, so am going to push this and then play with the test bot a bit more.

For example, I don't know why in #13 the failing tests say D8.4

Only change I made was to the __construct() declaration. I know it's nice to wrap those long argument lists but trying not to mix formatting with actual code changes. Also, trying to stick with core style here.

Committed to ee9ff35

recrit’s picture

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.

recrit’s picture

I also had $settings['install_profile'] set in my settings.php. Remove that appears to have fixed the issue since drupal_get_profile() will return NULL.
This is not ideal since then there is no "install_profile" set.

mpotter’s picture

Please create a new issue for this. This is an issue with an incompatibility between the ConfigInstaller interface assumed by Features in D8.2 and D8.3 with the additional ProfileHandler argument added to ConfigInstaller by the inherited profile patch in #1356276: Allow profiles to define a base/parent profile. Since this issue is closed/fixed nobody will see it and we don't want to post an additional patch in this fixed issue.

Status: Fixed » Closed (fixed)

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