Dependency version checking breaks for contrib versions like 8.x-8.x-rc1

Created on 3 October 2018, over 6 years ago
Updated 27 September 2023, almost 2 years ago

Problem/Motivation

Whilst reviewing #2677532: Move drupal_check_incompatibility() functionality to a new Dependency class and Version component β†’ I've discovered a significant bug in the current code both HEAD and with the patch. It's caused by how we prepare the version string for checking compatibility against it.

The suspect code is:

        $version = str_replace(\Drupal::CORE_COMPATIBILITY . '-', '', $required_file->info['version']);

If $required_file->info['version']) is 8.x-8.x-beta1 this would mean that we'd check the version using the string beta1 where the intention is to pass 8.x-beta1. A version string of 8.x-8.x-beta1 might feel unlikely but it is very possible. Panels is on 8.x-4.x for example.

Proposed resolution

Once #2677532: Move drupal_check_incompatibility() functionality to a new Dependency class and Version component β†’ lands, I think we should move the $version = str_replace(\Drupal::CORE_COMPATIBILITY . '-', '', $required_file->info['version']); functionality into \Drupal\Component\Extension\DrupalVersionRequirement::isCompatible() so callers don't have to think about this at all. So it supports both '8.x-3.0-beta1' and '3.0-rc1' for example.

Remaining tasks

User interface changes

None

API changes

None - the suggestion solution widens the strings that \Drupal\Component\Extension\DrupalVersionRequirement::isCompatible() accepts.

Data model changes

None

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 8 hours ago

Created by

πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024