Skip to content
Snippets Groups Projects

Issue #3276072: UpdateReleaseValidator doesn't handle legacy version numbers

1 file
+ 5
2
Compare changes
  • Side-by-side
  • Inline
@@ -33,13 +33,12 @@ class UpdateReleaseValidator implements EventSubscriberInterface {
$messages = [];
foreach (['production', 'dev'] as $package_type) {
foreach ($all_versions[$package_type] as $package_name => $sematic_version) {
$is_missing_version = FALSE;
$legacy_version = NULL;
$package_parts = explode('/', $package_name);
$project_name = $package_parts[1];
// If the version isn't in the list of installable releases, then it
// isn't secure and supported and the user should receive an error.
$releases = (new ProjectInfo($project_name))->getInstallableReleases();
$is_missing_version = FALSE;
if (empty($releases)) {
$is_missing_version = TRUE;
}
@@ -47,10 +46,14 @@ class UpdateReleaseValidator implements EventSubscriberInterface {
$legacy_version = LegacyVersionUtility::convertToLegacyVersion($sematic_version);
if ($legacy_version) {
if (!array_key_exists($legacy_version, $releases)) {
// If we cannot find the version using semantic or legacy then the
// version is missing.
$is_missing_version = TRUE;
}
}
else {
// If we cannot convert the semantic version into a legacy version
// then the version is missing.
$is_missing_version = TRUE;
}
}
Loading