Bug: Incorrect PHP version
jlHertel opened this issue · 7 comments
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
On #128 the minimum PHP version was updated to PHP 8.2, although the README states that PHP 7.2 and Higher is supported.
Please consider downgrading the minimum PHP version to match the README or update the README to match the minimum version specified.
To reproduce
- Install any PHP version prior to 8.2
- Try to install de latest version of the library
Sample code (optional)
No response
Version
1.8.182
Expected behavior
The library install fine under PHP 7.2 or higher, as advertised in the README.
Logs (optional)
No response
Additional context (optional)
The caret used to specify the PHP version (https://getcomposer.org/doc/articles/versions.md#caret-version-range-) acts as a minimum version, which is why we are seeing this issue. Changing the expression to something like ^7.2 || ^8.0
should do the trick of supporting all versions from 7.2 up to 8.2
Have you tried actually installing the library? AFAIK it should work because for each supported php version this library is downgraded automatically. The version should be 1.8.172 (or 1.8.272), the last two numbers contain the php version supported.
@RikudouSage That is a very curious way to publish the library. Do you mind to share the script that is used to downgrade the library for each PHP version?
About installing, yes I do have the library installed on a PHP 8.1 machine and noticed the issue when trying to update from 1.8.281
to 1.8.282
. Here is the output of the install command:
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- unleash/client is locked to version v1.8.282 and an update of this package was not requested.
- unleash/client v1.8.282 requires php ^8.2 -> your php version (8.1.5) does not satisfy that requirement.
To give more context here: I use this library in a project that has renovate enabled. Renovate automatically tries to create PRs with the latest libraries updates. That's how I arrived at this issue.
It's here: https://github.com/Unleash/unleash-client-php/blob/main/.github/workflows/release.yaml#L36
Can you somehow tell renovate to not do this? Because 1.8.282 is indeed for php 8.2, while 1.8.281 is the same codebase but for php 8.1.
At a quick glance it seems packageRules
with allowedVersions
could be used, though I have no experience with renovate.
After getting this context, I believe the issue lies totally on renovate side of things, so not a real bug on this project. Feel free to close this issue.
Since we are on the subject: it might be beneficial to use semantical versioning and have a single release for all PHP versions that are supported. From the script you shared above, it seems the only version that needs special handling is PHP 7.2, which is end-of-life for 2 years already (even PHP 8.0 has only 10 months left of support, see here).
It's totally up to you which versions you would like to support, but I believe it might reduce the maintenance burden if you support only actively maintained versions of PHP.
Thanks for the great input and clarification and also for maintaining such a great package.
That's sadly impossible because we need to support older php versions (and I think Debian supports them still even though the PHP core does not). And if you take a look for example here you can see everything that's changed automatically to downgrade it to php 7.4.
This approach was chosen because getting stuck at 7.x syntax level is not that great but the code needs to run on them.
As for semantic versioning, it does support it, major, minor and patch versions are all according to semver and the version numbers rely on the fact that composer chooses the biggest version that's available for your php version - right now it's 1.8.2x, where x is one of [72, 73, 74, 80, 81, 82], so if you're on php 8.1, composer will automatically choose 1.8.281, while on php 7.3 it will choose 1.8.273.