version icon indicating copy to clipboard operation
version copied to clipboard

greater than (e.g. >=3.6) not supported

Open tacman opened this issue 2 years ago • 3 comments

I'm trying to parse the version string

 symfony/monolog-bundle: >=3.6 

on https://packagist.org/packages/antonchernik/logging-bundle,

3^ PharIo\Version\UnsupportedVersionConstraintException^ {#4853
  #message: "Version constraint >=3.6 is not supported."
  #code: 0
  #file: "./vendor/phar-io/version/src/VersionConstraintParser.php"
  #line: 22
  trace: {
    ./vendor/phar-io/version/src/VersionConstraintParser.php:22 { …}

tacman avatar Jan 30 '24 12:01 tacman

We so far did not implement these as their use is discouraged. Using unbounded constraints like these is a disaster waiting to happen but I can see that we might have to support (read: at least understand) it.

theseer avatar Jan 31 '24 23:01 theseer

Please consider it, I'm working on an open-source app that allows searching packagist for Symfony bundles that meet certain criteria (like at least php 8.2 and Symfony at least 6.4 or 7.0). I can assure you that LOTS of packages use this format, and even the composer docs talk about it.

When you write a version constraint, it may reference a specific tag (e.g., 1.1) or it may reference a valid range of tags (e.g., >=1.1 <2.0, or ~4.0).

https://getcomposer.org/doc/articles/versions.md#tags

tacman avatar Jan 31 '24 23:01 tacman

I agree with you on the problems. In fact, many bundles are returned as being compatible with Symfony 7 because the constrait is ">= 2.2". Terrible.

BUT many of the php constraints do work, even php >= 7.2 often works, where php ^7.2 fails with PHP 8, even if php 8 works. And getting authors of these old libraries to accept PRs is often difficult.

tacman avatar Feb 01 '24 00:02 tacman