简体   繁体   中英

Zend Framework 2 - Composer - Behat / Guzzle Conflict

Here is my composer.json file:

{
    "name": "lorem-ipsum",
    "description": "Lorem Ipsum",
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.4",
        "symfony/console": ">=2.0.0,<2.2.0-dev",
        "symfony/config": ">=2.0.0,<2.2.0-dev",
        "symfony/dependency-injection": ">=2.0.0,<2.2.0-dev",
        "symfony/event-dispatcher": ">=2.0.0,<2.2.0-dev",
        "symfony/translation": ">=2.0.0,<2.2.0-dev",
        "symfony/yaml": ">=2.0.0,<2.2.0-dev",
        "symfony/finder": ">=2.0.0,<2.2.0-dev",
        "zendframework/zendframework": "2.*",
        "doctrine/doctrine-module": "dev-master",
        "doctrine/doctrine-orm-module": "0.*",
        "gedmo/doctrine-extensions": "dev-master"
    },
    "require-dev": {
        "phpunit/phpunit": "3.7.*",
        "behat/behat": "2.4.*@stable",
        "behat/mink": "1.4@stable",
        "behat/mink-goutte-driver": "*",
        "symfony/browser-kit": "2.1.*",
        "symfony/css-selector": "2.1.*",
        "symfony/dom-crawler": "2.1.*",
        "symfony/process": "2.1.*",
        "guzzle/http": "2.8.*",
        "behat/mink-sahi-driver": "*"
    },
    "autoload": {
        "psr-0": {
            "Behat\\Behat": "src/"
        }
    }
}

When I do:

php composer.phar update --dev

I get:

Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove guzzle/parser v2.8.8
    - Conclusion: don't install guzzle/parser v2.8.8
    - fabpot/goutte 1.0.x-dev requires guzzle/guzzle 3.0.* -> satisfiable by guzzle/guzzle v3.0.0, guzzle/guzzle v3.0.1, guzzle/guzzle v3.0.2, guzzle/guzzle v3.0.3, guzzle/guzzle v3.0.4, guzzle/guzzle v3.0.5.
    - fabpot/goutte 1.0.x-dev requires guzzle/guzzle 3.0.* -> satisfiable by guzzle/guzzle v3.0.0, guzzle/guzzle v3.0.1, guzzle/guzzle v3.0.2, guzzle/guzzle v3.0.3, guzzle/guzzle v3.0.4, guzzle/guzzle v3.0.5.
    - Can only install one of: guzzle/guzzle v3.0.0, guzzle/guzzle v2.8.8.
    - Can only install one of: guzzle/guzzle v3.0.1, guzzle/guzzle v2.8.8.
    - Can only install one of: guzzle/guzzle v3.0.2, guzzle/guzzle v2.8.8.
    - Can only install one of: guzzle/guzzle v3.0.3, guzzle/guzzle v2.8.8.
    - Can only install one of: guzzle/guzzle v3.0.4, guzzle/guzzle v2.8.8.
    - Can only install one of: guzzle/guzzle v3.0.5, guzzle/guzzle v2.8.8.
    - Installation request for guzzle/parser v2.8.8 -> satisfiable by guzzle/guzzle v2.8.8, guzzle/parser v2.8.8.
    - Installation request for fabpot/goutte 1.0.x-dev -> satisfiable by fabpot/goutte 1.0.x-dev.

This was not happening few days ago, I have been using this composer.json file for few weeks and it always installed ok.

The issue seems to be that you require guzzle/http 2.8.* in require-dev. Since 2.8.8 is installed in your dev dependencies, when you try to update it will first update the normal requirements, while completely preventing the dev requirements from changing.

At this point, since fabpot/goutte apparently now requires guzzle 3.0.* , it goes south because it wants to keep 2.8.8 and needs to install 3.0.* .

The solution is to rm -rf vendor/guzzle, to make sure the current dependencies are gone from your current state. Then running update should go well until it updates the dev dependencies, at this point it will still complain about 2.8.8 not being compatible with 3.0.* , so you should update your require-dev line too to specify 3.0.* . If that's a problem for you, try to use an older tagged version of goutte if available.

I have solved the issue by specifying versions of all packages explicitly for now:

{
    "name": "lorem-ipsum",
    "description": "Lorem ipsum",
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.4",
        "zendframework/zendframework": "2.0.4",
        "doctrine/doctrine-module": "0.5.2",
        "doctrine/doctrine-orm-module": "0.5.3",
        "gedmo/doctrine-extensions": "2.3.1"
    },
    "require-dev": {
        "phpunit/phpunit": "3.7.9",
        "guzzle/guzzle": "3.0.5",
        "behat/behat": "2.4.4",
        "behat/mink": "1.4",
        "behat/mink-goutte-driver": "1.0.3",
        "behat/mink-sahi-driver": "1.0.0",
        "squizlabs/php_codesniffer": "1.4.2",
        "phpmd/phpmd": "1.4.0"
    },
    "autoload": {
        "psr-0": {
            "Behat\\Behat": "src/"
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM