mediamonks/drupal-controller-annotations

Requires PHP 7?

Closed this issue · 8 comments

Hi,
when trying to run composer require drupal/controller_annotations, it says:

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

Problem 1
- symfony/framework-bundle 4.0.x-dev requires php ^7.1.3 -> your PHP version (5.6.31) does not satisfy that requirement.
- Conclusion: remove phpdocumentor/reflection-docblock 2.0.5
- Conclusion: don't install phpdocumentor/reflection-docblock 2.0.5
[..]

It goes on from there, trying to somehow make it work.
So my question is, is it currently possible to install this on PHP 5.6?

I currently still have Drupal 7 sites which I do not want to take the trouble of making them compliant with PHP 7. This is why I am still on PHP 5.6.
Maybe I should use Docker.. just did not take the time yet to make myself familiar with it and make it work on my system.

This package requires sensio/framework-extra-bundle 3.0+ so I'm not sure why it tries to use the 4.0-dev one. My best guess is that somewhere you have "minimum-stability: dev" in your composer.json which could cause this (and also something I do not recommend). As a workaround you can try to manually require the 3.0 version by running:

composer require sensio/framework-extra-bundle ~3.0

and then require this package and see if it works.

I cannot make it work :(

My best guess is that somewhere you have "minimum-stability: dev" in your composer.json which could cause this

I tried with and without this setting, didn't help much.
I think I originally have this setting because I followed the instructions here, https://github.com/drupal-composer/drupal-project. They suggest to install with --stability dev, maybe there are reasons.

Unfortunately, the messages from Compser are not very useful sometimes.

If it helps, here is my composer.json:

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0+",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "composer/installers": "^1.2",
        "cweagans/composer-patches": "^1.6",
        "drupal-composer/drupal-scaffold": "^2.2",
        "drupal/console": "~1.0",
        "drupal/core": "~8.0",
        "drush/drush": "~8.0",
        "webflo/drupal-finder": "^0.3.0",
        "webmozart/path-util": "^2.3"
    },
    "require-dev": {
        "behat/mink": "~1.7",
        "behat/mink-goutte-driver": "~1.2",
        "jcalderonzumba/gastonjs": "~1.0.2",
        "jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
        "mikey179/vfsstream": "~1.2",
        "phpunit/phpunit": ">=4.8.28 <5",
        "symfony/css-selector": "~2.8"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
      "sort-packages": true
    },
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ]
    },
    "scripts": {
        "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/libraries/{$name}": ["type:drupal-library"],
            "web/modules/contrib/{$name}": ["type:drupal-module"],
            "web/profiles/contrib/{$name}": ["type:drupal-profile"],
            "web/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"]
        }
    }
}

I tried different variations of everything.
As an example for the kind of problems that show up:

$ composer require symfony/framework-bundle ~3.3.0 --update-no-dev
./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove drupal/core 8.3.6
    - Conclusion: don't install drupal/core 8.3.6
    - Conclusion: don't install symfony/framework-bundle v3.3.6
    - Conclusion: don't install symfony/framework-bundle v3.3.5
    - Conclusion: don't install symfony/framework-bundle v3.3.4
    - Conclusion: don't install symfony/framework-bundle v3.3.3
    - Conclusion: don't install symfony/framework-bundle v3.3.2
    - Conclusion: don't install symfony/framework-bundle v3.3.1
    - Conclusion: don't install symfony/framework-bundle v3.3.0
    - Conclusion: don't install symfony/framework-bundle v3.3.0-RC1
    - Installation request for drupal/core (locked at 8.3.6, required as ~8.0) -> satisfiable by drupal/core[8.3.6].
    - Conclusion: don't install symfony/framework-bundle v3.3.0-BETA1
    - drupal/core 8.3.6 requires symfony/validator ~2.8 -> satisfiable by symfony/validator[v2.8.26, 2.8.x-dev, v2.8.0, v2.8.0-BETA1, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.18, v2.8.19, v2.8.2, v2.8.20, v2.8.21, v2.8.22, v2.8.23, v2.8.24, v2.8.25, v2.8.3, v2.8.4, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[2.8.x-dev].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.0].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.0-BETA1].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.1].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.10].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.11].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.12].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.13].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.14].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.15].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.16].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.17].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.18].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.19].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.2].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.20].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.21].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.22].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.23].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.24].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.25].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.26].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.3].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.4].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.5].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.6].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.7].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.8].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.9].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.26].
    - symfony/framework-bundle 3.3.x-dev conflicts with symfony/validator[v2.8.26].
    - Installation request for symfony/framework-bundle ~3.3.0 -> satisfiable by symfony/framework-bundle[3.3.x-dev, v3.3.0, v3.3.0-BETA1, v3.3.0-RC1, v3.3.1, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6].


Installation failed, reverting ./composer.json to its original content.

Manually installing a specific version of symfony/framework-bundle is just one thing I tried. I am not saying that this is a good idea, I just want to give you something to look at.

Oh here is why!
https://packagist.org/packages/symfony/framework-bundle
At the bottom in "conflicts" you see symfony/validator: <3.3. Damnit. Now what?

The symfony/framework-bundle is required by drupal/controller_annotations.
The symfony/validator ~2.8 is required by drupal/core.

I'll look into it tomorrow, it's weird how I didn't see this issue yet when testing it with different versions of PHP and Drupal (8.0 till 8.4) as can be seen on Travis build logs.

I see you require 3.3.0 specifically now, what happens if you require ~3.0? That one has no conflict with the 2.8 components that Drupal is using.

Ok my most recent experiments showed this:

  • composer require drupal/controller_annotations --update-no-dev did result in the dependency mess.
  • Manually adding "drupal/controller_annotations": "1.x-dev" to composer.json and running composer update --prefer-dist --no-dev did work fine (the parameters seem to make no difference, I just report the parameters that I used most recently).
  • It takes ~90 seconds, which is painful, and makes it costly to try and compare different variations.

It seems that depending on the way that the package is added to composer.json, Composer sometimes tries to use a version of symfony/framework-bundle that causes dependency issues, and then it fails to recover and resolve.

This seems to be related only to projects based on drupal-composer/drupal-project, a regular download from drupal.org is totally fine. I could trace it back to drupal/console which allows some symfony ~3.0 components to be used which conflict with the symfony/framework-bundle. The easy fix is to simply require the ~2.8 versions of both symfony/filesystem and symfony/config (in that order) and then it will install as expected. I'll create a note for this in the documentation, thanks for reporting.

A better solution is to simply not extend sensio/framework-extra-bundle anymore as it requires a lot of stuff which could create conflicts. I'll look into porting the few classes that are currently extended and see if I can remove this requirement all together.

sensio/framework-extra-bundle requirement is now gone in favor of just symfony/config which should make it much easier to install for various versions of Drupal. Will make code from Sensio more readable and I'll make sure everything will be fully tested again.