Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Workflows has a ConfigImportSubscriber that runs on all config imports.
It assumes that all config imported will be workflow entities.
Proposed resolution
Only process config that corresponds to a workflow entity.
Remaining tasks
Possibly rewrite the test class to test each type of import (simple config, non-workflow entity, workflow entity) separately
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Comment | File | Size | Author |
---|---|---|---|
#5 | 2900019-workflows-5-PASS.patch | 2.86 KB | tim.plunkett |
#5 | 2900019-workflows-5-FAIL.patch | 1.48 KB | tim.plunkett |
#3 | getentitytypeidbyname-2900019-3.patch | 1.9 KB | joelpittet |
#3 | interdiff.txt | 1.27 KB | joelpittet |
#2 | 2900019-workflow-2.patch | 1.52 KB | tim.plunkett |
Comments
Comment #2
tim.plunkettThis fixes the bug, mirroring the checking of the return value done in \Drupal\Core\Config\ConfigImporter.
However, I don't understand this method (and class) at all.
It runs for ALL entity types, and the @return indicates that.
Yet the calling code above it calls WorkflowInterface-specific methods on it:
Above that, I'd imagine this line is throwing undefined index errors:
Plus, as @joelpittet points out, this was running on all config data, including simple config, producing the above error.
It seems to me that the class was manually tested against workflow-only changes, and not when any other config data was being imported.
Comment #3
joelpittetDidn't have time to look into the tests but ran into more of what @tim.plunkett was talking about where the contact entity fatals in
ConfigImportSubscriber::onConfigImporterValidate()
when trying to callgetTypePlugin()
.Added a check for WorkflowInterface, this still needs tests but I'm going on vacation for a week so not likely to tackle those.
Comment #4
joelpittetOh and I got those undefined index errors too that was mentioned in #2
Comment #5
tim.plunkettHere's a solution with less overhead. It also neatly solves both bugs, which I've included test coverage for.
Comment #7
tim.plunkettComment #8
joelpittetThanks for adding a test, glad you found a way to speed up the check to avoid loading the entity.
Comment #11
larowlanCommitted as 2534957 and pushed to 8.5.x.
Cherry-picked as 39831c8 and pushed to 8.4.x.
Thanks for moving on this so fast.
Comment #12
timmillwoodThanks for fixing this!
I'm a little surprised the original patch didn't cause any core test fails. I guess we don't have extensive enough tests for config imports?
Comment #13
larowlan...while workflow module is enabled.
Comment #14
timmillwoodAh ha, yes, that is the key. Maybe we need a test that installs all modules then tests config import.
Comment #15
joelpittet#14 sounds like a good idea @timmillwood.
Comment #16
Sam152 CreditAttribution: Sam152 as a volunteer commented\Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait might be handy for a test like that.
Comment #17
joelpittetCreated the follow-up: #2903205: Add Config Import Test with all modules enabled