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 update fails due to conflicts with league/oauth2-server-bundle / symfony/psr-http-message-bridge #1236

Closed
RobertMe opened this issue Aug 23, 2023 · 1 comment

Comments

@RobertMe
Copy link

Hi,

First off I was unsure whether to report this as a recipes or a Flex issue, but as the issue occurs due to an change in the recipe (index) I think this would be a better place to report it.

I'm working in a project which has a dependency on league/oauth2-server-bundle, in turn this project depends on symfony/psr-http-message-bridge:^2.0. But when we now run composer update (or composer update -W) this fails due to a dependency issue, while a couple of weeks back it still worked fine.

composer update -W
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Restricting packages listed in "symfony/symfony" to "^6.3"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires league/oauth2-server-bundle ^0.5.0 -> satisfiable by league/oauth2-server-bundle[v0.5.0].
    - league/oauth2-server-bundle v0.5.0 requires symfony/psr-http-message-bridge ^2.0 -> found symfony/psr-http-message-bridge[v2.0.0, ..., v2.3.1] but these were not loaded, likely because it conflicts with another require.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

I could however manually update all packages by name, as long as I didn't try to update symfony/* (or presumably: as long as I didn't try to update symfony/psr-http-message-bridge)

After further investigation the problem was found to be related with our project having the extra.symfony.require property set to ^6.3 (oddly enough it works fine with ^5.4 set). So this meant the issue is related to Flex, and is confirmed by the fact that composer update --no-plugins works just fine.

Further investigation lead me to the recipes index containing the following info:

            "symfony/psr-http-message-bridge": [
                "6.4",
                "7.0"
            ],

which has only been added 3 weeks ago which also could match our time window from composer update working to not working.
Digging into the code further lead me to the conclusion that PackageFilter::removeLegacyPackages doesn't accept this (transitive) dependency because the versions Composer resolves (all versions in the 2.x series) don't match our extra.symfony.require constraint of ^6.3, the fact that this package is part of the recipes index (packages which aren't in the recipes index are always allowed with all versions), and it isn't a root dependency.

As a work-a-round I have now added an explicit dependency on symfony/psr-http-message-bridge to version ^2.3 which makes Flex just accept the Composer proposed versions and not validating it against the extra.symfony.require setting. But IMO this shouldn't be needed (or at least not as long that there is no actual stable release of symfony/psr-http-message-bridge which follows the Symfony versioning scheme, i.e.: as long as there is no stable 6.4 / 7.0).

nicolas-grekas added a commit to symfony/flex that referenced this issue Oct 30, 2023
… for versions before 6.4 (nicolas-grekas)

This PR was merged into the 1.x branch.

Discussion
----------

Decouple psr-http-message-bridge from extra.symfony.require for versions before 6.4

Should fix issues like getsentry/sentry-symfony#750 and symfony/recipes#1236

Before 6.4, the bridge was not in `symfony/symfony` so that `extra.symfony.require` shouldn't apply to earlier versions.

We *could* improve the API and flex to handle this concern at a more generic level, but this is so rare that I suggest hard-coding the rule in flex.

Commits
-------

42276be Decouple psr-http-message-bridge from extra.symfony.require for versions before 6.4
@nicolas-grekas
Copy link
Member

Fixed by symfony/flex#1003

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

No branches or pull requests

2 participants