Problem/Motivation

When a split is configured to use folder storage, but no path has been set, this leads to an unhelpful error message:

TypeError: Drupal\config_split\ConfigSplitManager::singleImportOrActivate(): Argument #2 ($storage) must be of type Drupal\Core\Config\StorageInterface, null given

While it is the developer's responsibility to set up a correct configuration, it would be nice to point out exactly what is wrong.

Steps to reproduce

  1. Configure a split to use folder storage, but set the folder path to an empty string.
  2. Activate the split.

Proposed resolution

We can introduce an assert() that checks whether the path is configured. This is a low impact improvement which will show up only on developer environments, as opposed to introducing an exception which is technically an API change.

CommentFileSizeAuthor
#2 3388784-2.patch739 bytespfrenssen
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pfrenssen created an issue. See original summary.

pfrenssen’s picture

Status: Active » Needs review
FileSize
739 bytes
pfrenssen’s picture

Issue summary: View changes
bircher’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for opening this issue and providing a patch.
This is a good compromise between making it more obvious what is going on and keeping it simple.

Just out of curiosity, I thought the folder was required when selecting the folder in the form, but how difficult would it be to add some config validation. I know core is on the way to make config validation much more of a thing so maybe that would be a good thing to add. Of course we can do that in a follow up issue too.

I'll commit this next time I work on config split

  • bircher committed 587ca883 on 2.0.x
    Issue #3388784 by pfrenssen: Alert developers if the config split folder...
bircher’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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