InstallProfile::validateProfile() fails the first time it runs. I wonder if I can expose a test that proves this.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | helper-profile_extension_list-3201074-6.patch | 792 bytes | chris burge |
| #2 | 3201074-test-only.patch | 577 bytes | dave reid |
Issue fork helper-3201074
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
dave reidComment #3
chris burge commentedClearing the cache won't help in all instances. See #3240928: Drupal\Core\Extension\ExtensionList::getPathnames() conflates cache and state values.
When using the
install-profiles:switchdrush command, it's possible to get the error below when a stagnant list of extensions is stored in state and the cache is empty:I believe resetting the extension list with the 'extension.list.profile' service is a viable workaround:
Comment #4
dave reidI was hoping the test would help expose the error to help fix, but I think the ExtensionList works differently when run under tests, so I wonder if we can't expose a failure.
Comment #5
chris burge commentedWe could look at core tests for ideas. I just opened a MR for the core issue, and tests are running right now.
Comment #6
chris burge commentedPatch attached. I haven't figured out test coverage, however.
Comment #7
chris burge commentedSteps to reproduce (with no patch initially):
Steps to reproduce (with patch initially):
Comment #8
dave reidIt would be useful to see where the backtrace is happening for the PHP notice here, just to figure out where it's coming from.
Comment #9
chris burge commentedHere's the call stack:
Here's where the exception is thrown in Helper by
Drupal\helper\InstallProfile::validateProfile():$this->profileListis populated by theextension.list.profileservice. Due to a bug (#3240928: Drupal\Core\Extension\ExtensionList::getPathnames() conflates cache and state values) in howDrupal\Core\Extension\ExtensionList::getPathnames()caches profile lists, the new profile, my_profile, is not registered by theextension.list.profileservice. As a result, whenDrupal\helper\InstallProfile::validateProfile()uses that out-of-date list, it can't find the new profile. Patch #6 provides a workaround by forcing theextension.list.profileservice to rebuild the profile list before using it.This discussion has been exclusive to the
::validateProfile()method; however, a workaround for the same core bug is already in place in the::switch()method:Comment #10
dave reidOkay so it's not necessarily the PHP warning that's the error, it's the fact that the exists() call returns FALSE, and doesn't allow the command to proceed. Gotcha. Yeah it would make sense to do the same workaround in the verify command as well.
Comment #11
chris burge commentedDo we need test coverage or is documenting the core issue sufficient?
Comment #14
dave reidMerged the changes into 8.x-1.x. Thanks! Leaving open for test coverage.
Comment #15
dave reidTest coverage moved to #3585526: Add missing test coverage