-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent application of stability flags in parseConstraint #154
Comments
less than and less than equal with stability flag produce results that I question as well.
|
I think you're probably right that all these are wrong, they're very edge casey, and as such probably not super critical fixes. But yeah it should be fixed if possible. |
@Seldaek I was wondering if stability flags should affect constraints at all, considering they are not restricted to a single part of constraint and really handled at repository filtering level with the lowest taking the effect. It should probably have no effect on indirect constraints in dependencies so be stripped from parsed constraint entirely. |
@Seldaek to clarify, I am willing to provide a PR as soon as I know the preferred direction for the change. |
Yeah I'm not sure myself. Need to think about it some more and first finish my vacation ;) |
Have a nice vacation. As I was researching this for renovate I collected following composer behavior examples that are relevant here:
Because stability affects whole range it makes very little sense to cut out just the very edge of the range. So, unless parsed constraints are changed to deal with minimum stability within range, I believe sensible approach is not to treat stability flag as part of the version and outright strip it for the parsed constraint. |
VersionParser::parseConstraint()
does not take into consideration stability flag when parsing constraint with~
tilde or^
caret range:Constraint
~1.2.3@RC
is parsed as>=1.2.3.0-dev
and<1.3.0.0-dev
However
~1.2.3-RC
is parsed as>=1.2.3.0-RC
and<1.3.0.0-dev
as expected.I believe this inconsistency is a bug since
~
or^
returns early from a conditional block but stability flags are considered again much later in the method where it apples to not equal and less/greater operators.At the same time I see edge case with the way stability flag is handled with pre-release identifiers that are considered stable by composer:
>1.2.3@rc
->1.2.3.0-rc
>1.2.3-beta@rc
->1.2.3.0-beta
>1.2.3-stable@RC
->1.2.3.0-rc
>1.2.3-patch1@RC
->1.2.3.0-patch1-rc
I believe last constraint is invalid and as such a bug.
Hyphen ranges do not consider stability flags but also do not allow them on either side. No issue here.
Constraint with wildcards
1.2.*@rc
does not allow pre-release identifiers but allows stability flags which it then ignores.The text was updated successfully, but these errors were encountered: