We can install PHP extensions by fetching them from the PECL website with pecl install <package-handle>[-<spec>]
Where <spec> can be: - a stability state (snapshot, devel, alpha, beta, or stable) [1] - a version marching ^\d+(\.\d+)*([a-zA-Z]+\d*)?$ [2] if <spec> is not specified, it's assumed to be "stable" [3] When pecl resolves the actual version to be installed, it fetches http://pecl.php.net/rest/r/<package-handle>/allreleases.xml and returns the first version that's exactly the version specified, or has at least the stability specified [4]. The versions in the allreleases.xml file are sorted by the release date [5]. That way, pecl considers as the "last" stable version the most recent one. This works fine for packages that are published in a "linear" way. Problems arise when there are multiple versions maintained for a package (grpc and protobuf are good examples). For example, protobuf maintainers published version 3.21.6 on 2022-09-13 and version 3.18.3 one day later. So, in its allreleases.xml file [6] we have that 3.18.3 comes before 3.21.6, and pecl would have picked up the former instead of the latter. And this is a big problem: users aren't installing the most recent "stable" version [7]. I think that the easiest and cleanest solution would be to fix the code that generates the allreleases.xml file: it should sort the versions with the version_compare() PHP function. If that's OK, I can submit a pull request to the web-pecl repository, and someone who has access should regenerate the allreleases.xml files for every package published on the PECL archive. [1]: https://github.com/pear/pear-core/blob/ed08e2b2200980d9787211f81655f11f491d22dc/PEAR/Registry.php#L2322 [2]: https://github.com/pear/pear-core/blob/ed08e2b2200980d9787211f81655f11f491d22dc/PEAR/Registry.php#L2326 [3]: https://github.com/pear/pear-core/blob/ed08e2b2200980d9787211f81655f11f491d22dc/PEAR/Config.php#L217 [4]: https://github.com/pear/pear-core/blob/ed08e2b2200980d9787211f81655f11f491d22dc/PEAR/REST/10.php#L89 [5]: https://github.com/php/web-pecl/blob/706b4b0e4e3186f513ada25a283d84df7f8e0286/src/Rest.php#L430 [6]: https://pecl.php.net/rest/r/protobuf/allreleases.xml [7]: https://github.com/protocolbuffers/protobuf/issues/10619 -- PECL development discussion Mailing List (https://pecl.php.net/) To unsubscribe, visit: https://www.php.net/unsub.php