silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
720 stars 820 forks source link

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

Closed kinglozzer closed 2 months ago

kinglozzer commented 2 months ago

Module version(s) affected

5.2.0

Description

Appears to be a regression from https://github.com/silverstripe/silverstripe-framework/pull/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):

https://github.com/silverstripe/silverstripe-framework/blob/cca2f7059bc572497a8ed80f2d35e12a94984683/src/Core/Manifest/VersionProvider.php#L191-L195

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

https://github.com/silverstripe/silverstripe-framework/blob/97a8da8c7d223da9a4824e328cbeba92e7e83398/src/Core/Manifest/VersionProvider.php#L191-L193

How to reproduce

Install 5.2 without using recipe-core

Possible Solution

No response

Additional Context

No response

Validations

PRs

GuySartorelli commented 2 months ago

PR merged. It will be automatically tagged by GitHub Actions