Closed JimBacon closed 1 month ago
There is a tool for running checks on PHP compatibility which may be helpful, https://github.com/PHPCompatibility/PHPCompatibility
To test it out I performed the following steps on my Linux development system (which already had PHP installed) as follows.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
HASH=756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3
php -r "if (hash_file('sha384', 'composer-setup.php') === '$HASH''') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
sudo apt-get install php-xml
composer global require "squizlabs/php_codesniffer=*"
composer global require "phpcompatibility/php-compatibility=*"
~/.config/composer/vendor/bin
to PATH in ~/.bashrc
so the CodeSniffer executable can be found.phpcs --config-set installed_paths ~/.config/composer/vendor/phpcompatibility/php-compatibility
phpcs -i
phpcs -p . --standard=PHPCompatibility --runtime-set testVersion 7.3-
PHP 7.3 is approaching end of life in Dec 21. The most recent release is PHP 8.0. There is also PHP 7.4 with EOL in Nov 22.
To future-proof iRecord, we must ensure our code is compatible with PHP 8.0. This affects various components we have developed for which separate issues will be raised.
Drupal 7.79, released 7/4/2021, "is the first where D7 core's test suite passes tests in PHP 8.0. However, there may be remaining problems with PHP 8 in core, and it's very likely that there are problems in contrib." Drupal 8, which reaches end of life before Drupal 7 (Nov 21 and Nov 22 respectively), does not support PHP 8.0 Drupal 9.1 and upwards supports PHP 8.0
A move to PHP 8.0 therefore implies a move to Drupal 9. There is already an issue for this, https://github.com/BiologicalRecordsCentre/iRecord/issues/980
In order not to force other users of Indicia to upgrade to Drupal 9, while adding compatibility with PHP 8.0, backwards compatibility with PHP 7.3 and PHP 7.4 should be maintained.