singpolyma / openpgp-php

OpenPGP.php is a pure-PHP implementation of the OpenPGP Message Format (RFC 4880).
http://singpolyma.github.io/openpgp-php/
The Unlicense
179 stars 69 forks source link

PHP8 and thoughts on minimum PHP version #107

Closed jstanden closed 3 years ago

jstanden commented 3 years ago

Currently openpgp-php is the only Composer dependency in Cerb that prevents us from switching to PHP8.

The old, version-locked PHPUnit 5.6 doesn't work in PHP8, primarily due to the each() deprecated function having been removed.

Very minor changes are required to update the unit tests for PHPUnit 9.5. You just have to switch to the namespacedPHPUnit\Framework\TestCase in a couple subclasses and update the version in Composer.

With the latest PHPUnit, all of the unit tests still pass with PHP 8.0 by just adding || ^8.0 in composer.json.

However, PHPUnit 7.x requires PHP 7.1+, and PHPUnit 9.x requires PHP 7.3+.

PHP 7.3 active support just ceased a few weeks back on December 6, 2020. That leaves 7.4 as the only actively supported version in 7.x until that line is retired in November 2021 in favor of 8.x.

I recall reading on a past issue here (regarding PHP 7.4 deprecated curly braces) that PHP 5.4 compatibility was still desirable in the testing and deployment matrix. Is that still the case?

If so, I'd like to propose maintaining two parallel versions (e.g. 0.x and 1.x) of this project. Users who still need PHP 5.4 support can remain anchored to the 0.x versions via Composer, and modern PHP users (which must be most of us) can use the latest versions.

This should be a very minor change to help make this project accessible to more people.

I can add a fork with these changes to our Composer dependencies for now. I'll submit pull requests for the other changes.

Thanks again for maintaining this library! It's been far superior to ext/gnupg.

singpolyma commented 3 years ago

Closed by #109

jstanden commented 3 years ago

Thanks for the quick turnaround!

Once Packagist is updated we can switch back to your official repository from my fork.