Problem/Motivation
- PHP 7.3 is now end-of-life, and PHP 7.4 will be end-of-life in Nov. 2022.
- Drupal 9 will be supported until November 2023.
- Drupal 9.4 is probably the final minor release of Drupal 9.
Background information
-
When a PHP version becomes end-of-life under PHP's own policy, some Composer packages begin dropping support for those old versions (even though the PHP version might still receive security coverage from distros).
-
If a Drupal dependency drops support for an old PHP version, and later releases a security update, Drupal core must either increase its own minimum PHP requirement or mitigate the security vulerability another way. This notably happened with SA-CORE-2018-005, when two Drupal dependencies dropped PHP 5.5 support within a year of PHP 5.5's end-of-life by PHP, before Drupal's scheduled end of PHP 5.5 support.
-
Creating custom mitigations can also delay the release of security fixes (which again was almost a serious issue for SA-CORE-2018-005, since the reporter was going to disclose the issue regardless of whether Drupal was fixed).
-
The
drupal/core-recommended
metapackage locks dependencies to the specific lockfile version of dependencies, as does the compiledvendor/
code in Drupal tarball installations. Furthermore, the site will not be able to resolve to secure dependencies if it is on an old PHP version. This means that even if core does implement a custom mitigation, the site may still be locked into running insecure code from an insecure dependency.
-
On the other hand, increasing Drupal's
MINIMUM_PHP
prevents Drupal sites from installing any Drupal updates at all unless they also increase their platform PHP version accordingly. This is extremely disruptive and dangerous, especially if it happens on a security window. Many site owners found it too disruptive even in a minor release of Drupal core.
-
As a middle ground, the constant
\Drupal::MINIMUM_SUPPORTED_PHP
was introduced in #3039287: Implement changes required to remove support for PHP 5.5 and 5.6, to allow sites to be updated on old PHP versions, but still warn them that the PHP version was too old.
History of PHP requirements for Drupal 9
-
Here is the current text in the system requirements docs:
https://www.drupal.org/docs/system-requirements/php-requirements#php_req... -
Here's the only thing the 9.0.0 release notes said about the PHP version requirement:
Drupal 9 requires PHP 7.3 or higher, and the version requirement for Apache has been increased to Apache 2.4.7 or higher.
-
The only CR for any D9 branch about it: https://www.drupal.org/node/3089166
-
Drupal 8.9 and 9.0 were not compatible with PHP 8; in fact we explicitly had to indicate they were incompatible:
https://www.drupal.org/node/3180764
-
The recommended PHP version was increased in 9.2.x to 7.4 (#3214920: Increase DRUPAL_RECOMMENDED_PHP to 7.4), and again in 9.3.x to 8.0 (#3214924: Increase DRUPAL_RECOMMENDED_PHP to 8.0 in Drupal 9.3 or 9.4). Neither issue even had a CR. (They probably should have.)
-
Here's what HEAD does currently on PHP 7.3.
Proposed resolution
- Change the behavior of
\Drupal::MINIMUM_SUPPORTED_PHP
to warn on installation (rather than erroring) the same as it does on update, since various site update/deployment workflows use installation from default config. - Increase
\Drupal::MINIMUM_SUPPORTED_PHP
to at least 7.4 in Drupal 9.4.
Remaining tasks
See #96, #106, #107, and #108.
Followup issues
- #3261602: Display installation warnings in the quick-start command
- Similar issue needed for Drush.
- #3261606: Provide more specific messaging about the consequences of using an unsupported PHP version
User interface changes
Before
An informational status report message is displayed:
There are no warnings on installation or update
After
A warning is displayed on the status report, informing the user that their version of PHP is too old:
The same warning is displayed in the installer:
To advance to the next screen of the installer, they have to scroll to the end of the page and click a small "continue anyway" link.
No warning is displayed yet when using the quick-start
command or drush si
; those would be handled in followups.
The same warning is displayed when running update.php
:
A similar message is displayed when running drush updb
:
[ayrton:drupal_test_site | Sat 20:27:59] $ vendor/bin/drush updb
[warning] Your PHP installation is too old. Drupal requires at least PHP /7.4.0/. It is
recommended to upgrade to PHP version /8.0/ or higher for the best ongoing
support. See PHP's version support documentation [1] and the Environment
requirements of Drupal 9 [2] page for more information.
[1] http://php.net/supported-versions.php
[2] https://www.drupal.org/docs/9/how-drupal-9-is-made-and-what-is-included/environment-requirements-of-drupal-9#s-php-version-requirement
(Currently using PHP 7.3.33
)