Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291715

Add upper PHP constraint to composer.json

$
0
0

Problem/Motivation

Although Drupal contains checks against the minimum supported version of PHP, currently there are no checks to stop the user from running Drupal with a version of Drupal that is newer than supported. For example, users who attempt to use Drupal 8.8.1 with PHP 7.4 will encounter problems, and there is nothing beyond documentation to warn them that this configuration does not work.

Proposed resolution

Add guards so that Drupal installations on new versions of PHP will fail-fast.

  • Drupal's composer dependencies should also have a constraint rejecting versions of PHP that are too new.
  • Drupal should have a constant DRUPAL_MAXIMUM_PHP to compliment DRUPAL_MINIMUM_PHP; it should be used in the same ways the existing constant currently is.

Remaining tasks

Add DRUPAL_MAXIMUM_PHP and corresponding checks.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

Drupal's composer.json file now constrains the maximum supported PHP version in addition to the minimum version.

Original report

I got a little over-zealous in bumping the PHP version for my Drupal project's Docker environment and discovered that Drupal 8.8.x has a known incompatibility with PHP 7.4 (being worked on at #3086374) but this is not expressed in composer.json, and there are no current core dependencies that otherwise block installation on PHP >= 7.4.

This patch adds an upper bound to PHP 7 compatibility to < 7.4.0, which will help address this issue at current and also on any future release cycle that is behind or otherwise out-of-sync with a new PHP 7 minor version. (E.g., when PHP 7.4 compatibility comes in, this can change to < 7.5.0).

I'm not sure of the exact internals of testbot relative to composer install, so unsure if this requires any follow-up on infra or in a test? This can be validated after the install by a failure, with some manual testing (The composer package is built from latest PHP stable version):

$ docker run --rm -u `id -u` -v `pwd`:/src -w /src/core composer:1.9 install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - This package requires php >=7.0.8 <7.4.0 but your PHP version (7.4.1) does not satisfy that requirement.

Viewing all articles
Browse latest Browse all 291715

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>