Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutOfBoundsException thrown when recipe-core isn't installed #11197

Closed
2 tasks done
kinglozzer opened this issue Apr 11, 2024 · 1 comment
Closed
2 tasks done

OutOfBoundsException thrown when recipe-core isn't installed #11197

kinglozzer opened this issue Apr 11, 2024 · 1 comment

Comments

@kinglozzer
Copy link
Member

kinglozzer commented Apr 11, 2024

Module version(s) affected

5.2.0

Description

Appears to be a regression from #11157

If framework is installed without recipe-core, when it attempts to find the version of that package an OutOfBoundsException is thrown by Composer’s InstalledVersions::getPrettyVersion() as the package isn’t installed.

The old code would quietly skip the package if it wasn’t installed (it’d never be encountered in the loop):

foreach ($lockData['packages'] as $package) {
if (in_array($package['name'], $modules ?? []) && isset($package['version'])) {
$versions[$package['name']] = $package['version'];
}
}

Suggest we just add an if (InstalledVersions::isInstalled($module)) check to the new code before trying to fetch the pretty version:

foreach ($modules as $module) {
$versions[$module] = InstalledVersions::getPrettyVersion($module);
}

How to reproduce

Install 5.2 without using recipe-core

Possible Solution

No response

Additional Context

No response

Validations

  • Check that there isn't already an issue that reports the same bug
  • Double check that your reproduction steps work in a fresh installation of silverstripe/installer (with any code examples you've provided)

PRs

@GuySartorelli
Copy link
Member

PR merged. It will be automatically tagged by GitHub Actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants