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

Ubuntu: Custom version string messes with version comparison checks #4319

Closed
zanbaldwin opened this issue Jul 30, 2015 · 18 comments · Fixed by #4321
Closed

Ubuntu: Custom version string messes with version comparison checks #4319

zanbaldwin opened this issue Jul 30, 2015 · 18 comments · Fixed by #4321
Labels

Comments

@zanbaldwin
Copy link
Contributor

The config.platform.php setting is currently messing up the version comparison checks in Composer on Ubuntu (14.04.1, Linux 3.16.0-45, x86_64). Without the setting, everything installs correctly without errors; however the following error occurs when it is present:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for humbug/humbug dev-master -> satisfiable by humbug/humbug[dev-master].
    - humbug/humbug dev-master requires php >=5.4.0 -> your PHP version (5.5.9-1ubuntu4.11) does not satisfy that requirement.

Since this custom version string will occur on every single installation of PHP installed through Ubuntu's package manager (default repositories), this will affect many people - especially since Symfony are now using the config.platform.php setting in their new Demo application since v0.4.0.

The composer.json file I used to test this is as follows:

{
    "name": "composer/version-resolution-issue",
    "description": "",
    "minimum-stability": "dev",
    "require": {
        "humbug/humbug": "dev-master"
    },
    "config": {
        "platform": {
            "php": "5.3.9"
        }
    }
}

Since I'm referencing the master branch of humbug/humbug and liable to change, the commit at the time of testing was humbug/humbug@facf911.

@stof
Copy link
Contributor

stof commented Jul 30, 2015

Well, the version comparison is not messed up. The only thing being messed up is the display of the php version in error messages (it should take it from config.platform.php when defined as this is the version used during the dependency resolution)

@alcohol
Copy link
Member

alcohol commented Jul 31, 2015

Yes, the error it is actually throwing is that "5.3.9" is below the requirement of ">=5.4.0". But in the error it displays the actual PHP version, not the one defined through "config.platform.php".

@alcohol
Copy link
Member

alcohol commented Jul 31, 2015

Not so easy to fix it turns out. Might be able to make the message more clear for the time being however.

Duplicate of #2697 also.

alcohol added a commit to alcohol/composer that referenced this issue Jul 31, 2015
* determine conflicting version in problem using pool package
* hide version in rule to keep it generic rather than possibly misleading

fixes composer#4319
@malutanpetronel
Copy link

so how to fix this please ?
Your requirements could not be resolved to an installable set of packages.
*

  • Problem 1
  • - doctrine/migrations dev-master requires php >=5.4.0 -> your PHP version (5.3.10-1ubuntu3.20) or "config.platform.php" value does not satisfy that requirement.
    ...

@alcohol
Copy link
Member

alcohol commented Oct 3, 2015

In your case you simply don't have the required php version. Upgrade your
installation of php.
On Oct 3, 2015 6:36 PM, "Petronel MALUTAN" notifications@github.com wrote:

so how to fix this please ?
Your requirements could not be resolved to an installable set of packages.
*

  • Problem 1
  • - doctrine/migrations dev-master requires php >=5.4.0 -> your PHP
    version (5.3.10-1ubuntu3.20) or "config.platform.php" value does not
    satisfy that requirement. ...


Reply to this email directly or view it on GitHub
#4319 (comment).

@gintares
Copy link

I have the same error, described here
http://stackoverflow.com/questions/ask

My php version is 5.5.31. The error i am getting says :
- doctrine/migrations v1.2.2 requires php >=5.4.0 -> your PHP version (5.5.3

  1. or "config.platform.php" value does not satisfy that requirement.

5.5.3 > 5.4.0 thus there should not be error.
What can be done.

@gintares
Copy link

Seems a solution can be to use flag --ignore-platform-reqs
composer update --ignore-platform-reqs

@xabbuh
Copy link
Contributor

xabbuh commented Jan 22, 2016

@gintares Are you sure you do not have a custom PHP version configured in your composer.json file?

@alcohol
Copy link
Member

alcohol commented Jan 25, 2016

@xabbuh if he is using the latest Composer version, then that custom version should now be rendered in this message.

@xabbuh
Copy link
Contributor

xabbuh commented Jan 25, 2016

@alcohol So the string or "config.platform.php" valuewill even be displayed if the option wasn't used in the composer.json file?

@alcohol
Copy link
Member

alcohol commented Jan 25, 2016

Huh, seems I am mistaken:

$text .= ' -> your PHP version ('. phpversion() .') or value of "config.platform.php" in composer.json does not satisfy that requirement.';

I thought we worked on this a while ago.

@alcohol
Copy link
Member

alcohol commented Jan 25, 2016

Yeah see #4321. Not sure which of the messages is displayed here though.

@elvismdev
Copy link

So there's a fix for this yet? I'm using the latest version of composer and when adding packages to a Symfony2 installation I'm getting the same errors. I use Ubuntu as well.

elvismdev@elvismdev-XPS-L421X:~/Desktop/QBWCApp$ sudo composer self-update
[sudo] password for elvismdev: 
Updating to version 79ac2cac82cfdc5460fa378b758d9322d5422893.
    Downloading: 100%         
Use composer self-update --rollback to return to version 03299ff075236be27be356498d6c64def973fe41

elvismdev@elvismdev-XPS-L421X:~/Desktop/QBWCApp$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - aws/aws-sdk-php-symfony 1.1.0 requires php >=5.5 -> your PHP version (5.6.4-4ubuntu6.4) or value of "config.platform.php" in composer.json does not satisfy that requirement.
    - aws/aws-sdk-php-symfony 1.0.2 requires php >=5.5 -> your PHP version (5.6.4-4ubuntu6.4) or value of "config.platform.php" in composer.json does not satisfy that requirement.
    - aws/aws-sdk-php-symfony 1.0.1 requires php >=5.5 -> your PHP version (5.6.4-4ubuntu6.4) or value of "config.platform.php" in composer.json does not satisfy that requirement.
    - aws/aws-sdk-php-symfony 1.0.0 requires php >=5.5 -> your PHP version (5.6.4-4ubuntu6.4) or value of "config.platform.php" in composer.json does not satisfy that requirement.
    - aws/aws-sdk-php-symfony 1.1.0 requires php >=5.5 -> your PHP version (5.6.4-4ubuntu6.4) or value of "config.platform.php" in composer.json does not satisfy that requirement.
    - Installation request for aws/aws-sdk-php-symfony ~1.0 -> satisfiable by aws/aws-sdk-php-symfony[1.0.0, 1.0.1, 1.0.2, 1.1.0].

@alcohol
Copy link
Member

alcohol commented Feb 5, 2016

@elvismdev if you do not share your composer.json with us, we cannot help you.

@elvismdev
Copy link

Sure, here below my composer.json file.

{
    "name": "elvismdev/qbwc-app",
    "license": "proprietary",
    "type": "project",
    "autoload": {
        "psr-4": {
            "": "src/"
        },
        "classmap": [
            "app/AppKernel.php",
            "app/AppCache.php"
        ]
    },
    "require": {
        "php": ">=5.3.9",
        "symfony/symfony": "2.8.*",
        "doctrine/orm": "^2.4.8",
        "doctrine/doctrine-bundle": "~1.4",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~5.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "incenteev/composer-parameter-handler": "~2.0",
        "aws/aws-sdk-php-symfony": "~1.0",
        "consolibyte/quickbooks": "^3.1"
    },
    "require-dev": {
        "sensio/generator-bundle": "~3.0",
        "symfony/phpunit-bridge": "~2.7"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ]
    },
    "config": {
        "bin-dir": "bin",
        "platform": {
            "php": "5.3.9"
        }
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        }
    }
}

@cs278
Copy link
Contributor

cs278 commented Feb 5, 2016

@elvismdev near the end of that file, platform = 5.3.9.

@alcohol
Copy link
Member

alcohol commented Feb 5, 2016

What @cs278 said. Because you specify a specific php version under platform, Composer will treat that version as the "installed" php version, and 5.3.9 is < 5.5.

@elvismdev
Copy link

Thanks @cs278 @alcohol it finally worked, Symfony2 installer adds this specific platform parameter. Seems like Symfony folks are having a discussion over there if it should be kept or not by default because is causing confusion with many other users.

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

Successfully merging a pull request may close this issue.

8 participants