Skip to content
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

Composer cannot resolve 2.2.8-devphp7 version #5264

Closed
malkusch opened this issue Apr 29, 2016 · 14 comments
Closed

Composer cannot resolve 2.2.8-devphp7 version #5264

malkusch opened this issue Apr 29, 2016 · 14 comments
Labels

Comments

@malkusch
Copy link

malkusch commented Apr 29, 2016

With the following composer.json:

{
    "require-dev": {
        "ext-redis": "^2.2.4",
    }
}

Composer (6146f7a) thinks the installed extension doesn't match:

The requested PHP extension ext-redis ^2.2.4 has the wrong version (2.2.8-devphp7) installed. Install or enable PHP's redis extension.

I then even tried to explicitly require that 2.2.8-devphp7 version with

{
    "require-dev": {
        "ext-redis": "2.2.8-devphp7",
    }
}

And now composer cannot parse that version:

[UnexpectedValueException]
Could not parse version constraint 2.2.8-devphp7: Invalid version string "2.2.8-devphp7"

@stof
Copy link
Contributor

stof commented Apr 29, 2016

Well, 2.2.8-devphp7 is not a supported version number. So just require * for now, until ext-redis exposes a supported version number.

@malkusch
Copy link
Author

malkusch commented Apr 29, 2016

What exactly is broken with the version 2.2.8-devphp7? I understand that this is even a valid semver version. Reading composer's manual about versions my understanding is probably too limited to see why 2.2.8-devphp7 should be unsupported.

So just require * for now

Thanks for this suggestion, but I won't.

@alcohol
Copy link
Member

alcohol commented Apr 29, 2016

@malkusch except for historical reasons, Composer doesn't allow semver specifically.

    /**
     * Regex to match pre-release data (sort of).
     *
     * Due to backwards compatibility:
     *   - Instead of enforcing hyphen; an underscore, dot or nothing at all are also accepted.
     *   - Only stabilities as recognized by Composer are allowed to precede a numerical identifier.
     *   - Numerical-only pre-release identifiers are not supported, see tests.
     *
     *                        |--------------|
     * [major].[minor].[patch] -[pre-release] +[build-metadata]
     *
     * @var string
     */

So 2.2.8-dev7 would be ok, but 2.2.8-devphp7 is not because devphp is not a supported stability.

@alcohol
Copy link
Member

alcohol commented Apr 29, 2016

Can you give us the output of composer show -m?

Edit: sorry, command needs to be composer show -p

@malkusch
Copy link
Author

but 2.2.8-devphp7 is not because devphp is not a supported stability.

So this devphp has a special meaning in Composer land. Ok, I can understand not supporting that in the composer.json file, but in my case (which is PHP-7 plus ext-redis on travis) I think it's very confusing that the installed version 2.2.8-devphp7 cannot be compared against my ^2.2.4 constraint.

How about not giving devphp a special meaning on the side of the installed extensions?

composer show -p

ext-redis 0

@alcohol
Copy link
Member

alcohol commented Apr 30, 2016

We don't give it a special meaning. We simply cannot parse it. This means that the installed version ends up being unrecognized, and thus it defaults to 0. As 0 does not match a constraint of ^2.2.4, the requirement is considered unmet.

@alcohol alcohol closed this as completed Apr 30, 2016
@malkusch
Copy link
Author

We simply cannot parse it

How about changing that? Would you accept a PR which would be able to compare 2.2.8-devphp7 against a ^2.2.4 constraint?

@alcohol
Copy link
Member

alcohol commented May 2, 2016

Personally I'm ok with that, but when I first suggested to @Seldaek to support semver more according to their specification, he seemed a bit reluctant. So you'll have to convince him :-)

See composer/semver repo for details.

@malkusch
Copy link
Author

malkusch commented May 2, 2016

I guess you refer to composer/semver#15, right?

@alcohol
Copy link
Member

alcohol commented May 2, 2016

To some extend, this was discussed there, yes.

@Seldaek
Copy link
Member

Seldaek commented May 4, 2016

One possibility to improve this (since it seems impossible to get pecl devs to clean up their act) would be to add a fallback for extension versions if they don't parse we could just keep the digits ^\d+(\.\d+)* (and maybe the stability) and remove whatever follows so that it's parseable. It'd be best-effort and would result in 2.2.8 or 2.2.8-dev which is better than 0 I suppose.

Seldaek added a commit that referenced this issue May 16, 2016
@Seldaek
Copy link
Member

Seldaek commented May 16, 2016

Just pushed a fix that should make 2.2.8-devphp7 parse as 2.2.8

@malkusch
Copy link
Author

Thank you.

@ozahorulia
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants