Problem/Motivation
Make sure Drupal keeps being compatible with PHP 8. Work with dependencies as needed. See #3086374: Make Drupal 8 & 9 compatible with PHP 7.4 for how we did it with PHP 7.4. PHP 8.0 is feature frozen and beta4 is out, see https://www.php.net/archive/2020.php#2020-09-17-1
Proposed resolution
The following task list has been determined by testing on #3156595: Make Drupal 9 installable on PHP8.
1. Dependency updates to support PHP 8
To produce a list of dependencies that are blocking PHP 8 support, you can do the following. Make sure you use PHP 7.4+ to run it.
$ git clone --branch 9.1.x https://git.drupalcode.org/project/drupal.git whynotphp8
$ cd whynotphp8/
$ composer install
$ composer update
$ composer why-not php:8
Dependency | Links |
---|---|
composer/composer 1.10.13 | Should update to Composer 2.0. #3135247: Composer's "prefer-stable" setting cannot be relied on to produce a stable release is now in, we should consider it in #3128631: Update dependencies composer/composer and composer/semver to ^3. |
composer/semver 1.7.1 | |
doctrine/reflection 1.2.1 | https://github.com/doctrine/reflection/pull/43 |
fabpot/goutte 3.3.0 | Possibly #3176655: Use Behat\Mink\Driver\BrowserKitDriver directly instead of GoutteDriver for PHP 8 compatibility or if that does not work out https://github.com/FriendsOfPHP/Goutte/issues/429 |
laminas/laminas-diactoros 2.4.1 | https://github.com/laminas/laminas-diactoros/pull/46 |
laminas/laminas-escaper 2.6.1 | https://github.com/laminas/laminas-escaper/issues/8 |
laminas/laminas-feed 2.12.3 | https://github.com/laminas/laminas-feed/issues/27 |
typo3/phar-stream-wrapper 3.1.5 | https://github.com/TYPO3/phar-stream-wrapper/issues/64 |
Additionally to the composer reported dependencies above:
- behat/mink-selenium2-driver - https://github.com/minkphp/MinkSelenium2Driver/pull/320
2. Drupal issues that can be addressed in Drupal 8 & 9 today
These issues can proceed without worrying about the how and if vendor support works for PHP 8 since the changes are all PHP 7 compatible. We can keep the changes PHP 7.0 compatible to make things easy for Drupal 8.
- #3156542: \ReflectionParamter::getClass() is deprecated in PHP 8.0
- #3174662: Encapsulate \PDOStatement instead of extending from it or #3156881: Various methods of \Drupal\Core\Database\StatementInterface have changed their signature for PHP 8
3. Drupal issues that need a largely working PHP 8 build to test
- #3156887: \Drupal\system\Plugin\ImageToolkit\GDToolkit needs to support \GdImage objects for PHP 8 compatibility
Should be okay for PHP 7.0 because it's really only loosening what we expect in \Drupal\system\Plugin\ImageToolkit\GDToolkit::$resource but testing this will be harder without all the above fixes and the fixes to vendor.
DONE
- In/with dependencies:
- symfony/*, twig/twig, composer/* #3156558: Upgrade dependencies prior to 9.1.0 and #3157296: Upgrade dependencies prior to 9.1.0
- Update symfony contract php requirement - https://github.com/symfony/symfony/pull/37494
- phpspec/prophecy - https://github.com/phpspec/prophecy/pull/470
- phpdocumentor/reflection-docblock - https://github.com/phpDocumentor/ReflectionDocBlock/pull/240
- Symfony CMF #3176576: Update to Symfony CMF 2.3.3
- #3127141: Use PHPUnit 9 for PHP 7.4+, while keeping support for PHPUnit 8.4 in PHP 7.3
- Within Drupal itself:
- #3156944: Support nullable typehints and return types in ProxyBuilder and as a result support PHP 8
- #3156878: \Drupal\Component\Datetime\DateTimePlus should pass correct parameter types to checkdate()
- #3156885: Change \Drupal\error_test\Controller\ErrorTestController::generateWarnings() to throw E_NOTICE error compatible with PHP 8
- #3156879: \Drupal\Component\Utility\Bytes::toInt() - ensure $size is a number type
- #3156882: \Drupal\Core\Render\Element\StatusReport::preRenderGroupRequirements() and \Drupal\user\PermissionHandler::sortPermissions() sorts return bools
- #3156883: \Drupal\Core\Url ensure fragment is not an empty string
- #3170648: CKEditorPluginManager::getEnabledButtons throws warnings on PHP 8.0.0 beta3
- #3173958: PHP 8 error: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
- #3173888: Error handler signature changed in PHP 8
- #3174038: ZipArchive::open(): Using empty file as ZipArchive is deprecated in PHP 8
- #3173991: Incorrect passby reference use in anonymous functions
- #3174158: Division by zero is not warning since PHP 8.0 beta4
- #3174022: call_user_func_array() and named arguments in PHP 8
Remaining tasks
See above.
User interface changes
None.
API changes
Data model changes
None.