Problem/Motivation
After #3345607: Update to Package Manager 3.x landed i wanted to give it a try. problem is after installing project browser dev and automatic updated 3.x dev i run into a wsod when i try to access /admin/modules/browse . the error is:
The website encountered an unexpected error. Please try again later.
UnexpectedValueException: Invalid version string "10.1.x-dev a5c48d0" in Composer\Semver\VersionParser->normalize() (line 186 of /var/www/html/vendor/composer/semver/src/VersionParser.php).
Composer\Semver\Semver::satisfies('10.1.x-dev a5c48d0', '*') (Line: 202)
Drupal\package_manager\Validator\ComposerPluginsValidator->Drupal\package_manager\Validator\{closure}('10.1.x-dev a5c48d0', 'drupal/core-composer-scaffold')
array_filter(Array, Object, 1) (Line: 200)
Drupal\package_manager\Validator\ComposerPluginsValidator->validate(Object, 'Drupal\package_manager\Event\StatusCheckEvent', Object)
call_user_func(Array, Object, 'Drupal\package_manager\Event\StatusCheckEvent', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object) (Line: 52)
Drupal\project_browser\InstallReadiness->runStatusCheck(Object, Object) (Line: 50)
Drupal\project_browser\InstallReadiness->validatePackageManager() (Line: 162)
Drupal\project_browser\Controller\BrowserController->browse('')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 583)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 698)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)Steps to reproduce
1. Spin up a new drupal 10.1x-dev site with composer create "drupal/recommended-project:10.1.x-dev@dev" (running on ddev with php 8.2 and mariadb 10.5)
2. composer require 'drupal/project_browser:1.0.x-dev@dev'
3. composer require 'drupal/automatic_updates:3.0.x-dev@dev'
4. Install project browser and package manager on /admin/modules
5. on /admin/config/development/project_browser check allow installing ui (experimental)
6. go to /admin/modules/browse
7. the error happens
Proposed resolution
ComposerInspector::getInstalledPackagesList() should account for this. If it detects a -dev in a package's version, it should remove the commit hash, since it won't be needed for our purposes.
Composer's decision to display dev snapshot versions as BRANCH-dev HASH is intentional; it's what BasePackage::getFullPrettyVersion() does. This is not something we need to change upstream; it's just an oversight on our part. We never encountered it before because it is only done for packages that are installed from git or hg repositories (we develop on a core dev snapshot, but it is installed via a path repo, so composer show reports its version as, simply, 10.1.x-dev).
Remaining tasks
- ✅ File an issue about this project
- ☐ Manual Testing
- ☐ Code Review
- ☐ Accessibility Review
- ☐ Automated tests needed/written?
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | screenshot--Exception.png | 108.98 KB | chrisfromredfin |
Issue fork automatic_updates-3349966
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
chrisfromredfinMoving to Automatic Updates as this is an issue inside Package Manager.
Comment #3
chrisfromredfinI was able to reproduce this and tracked it down to ComposerPluginsValidator.php near line 195.
My fix is above, which strips off the hash part of "10.1.x-dev abcdef" by splitting on space and throwing it away. I can confirm that this fixes the whitescreen and allows Project Browser to work again.
What I DON'T know is:
(a) if this pattern appears anywhere else in the code, and needs to be fixed elsewhere
(b) if this is the _right_ way to fix it.
Comment #4
tedbow@chrisfromredfin thanks for the bug report!
Comment #5
tedbowwhoops @rkoller thanks!
Comment #7
phenaproximaSo, it is true that
10.1.x-dev a5c48d0is unparseable by Semver. It's also abbreviated; it's not a real constraint.Maybe if we try
10.1.x-dev#a5c48d0?Comment #8
chrisfromredfinNo it seems to hate that one just as much.
Comment #9
tedbowComment #10
phenaproximaComment #11
tedbowLooks good!
Comment #12
phenaproximaComment #13
phenaproximaComment #15
phenaproxima