Omnipay + Guzzle updates for Drupal 10 / PHP 8 compatibility

Created on 17 April 2022, over 2 years ago
Updated 25 September 2023, about 1 year ago

Problem/Motivation

Update so that we can install against current Drupal (testing against D9.4)

Steps to reproduce

composer require "drupal/commerce_dps:^2.0.0@stable"
./composer.json has been updated
Running composer update drupal/commerce_dps
Gathering patches from patch file.
No patches supplied.
> 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
    - php-http/guzzle7-adapter[dev-master, 0.1.1, 1.0.0] require guzzlehttp/guzzle ^7.0 -> found guzzlehttp/guzzle[dev-master, 7.0.0-beta.1, ..., 7.4.x-dev (alias of dev-master)] but the package is fixed to 6.5.5 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - php-http/guzzle7-adapter 0.1.0 requires php ^7.2 -> your php version (8.0.17) does not satisfy that requirement.
    - league/omnipay v3.1.0 requires php ^7.2 -> your php version (8.0.17) does not satisfy that requirement.
    - league/omnipay v3.0.0 requires php ^7.1 -> your php version (8.0.17) does not satisfy that requirement.
    - league/omnipay[v3.0-alpha.1, ..., v3.0.2] require php ^5.6|^7 -> your php version (8.0.17) does not satisfy that requirement.
    - league/omnipay[v3.2.1, ..., 3.2.x-dev] require php-http/guzzle7-adapter ^1 -> satisfiable by php-http/guzzle7-adapter[1.0.0, 1.x-dev (alias of dev-master)].
    - drupal/commerce_dps 2.0.0 requires league/omnipay ~3.0 -> satisfiable by league/omnipay[v3.0-alpha.1, ..., 3.2.x-dev].
    - php-http/guzzle7-adapter 1.x-dev is an alias of php-http/guzzle7-adapter dev-master and thus requires it to be installed too.
    - league/omnipay v3.2.0 requires php-http/guzzle7-adapter ^0.1 -> satisfiable by php-http/guzzle7-adapter[0.1.0, 0.1.1].
    - Root composer.json requires drupal/commerce_dps ^2.0.0@stable -> satisfiable by drupal/commerce_dps[2.0.0].

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

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡³πŸ‡ΏNew Zealand xurizaemon Ōtepoti, Aotearoa 🏝

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand dieuwe Auckland, NZ

    The change to omnipay 3.2 in the issue fork works - but with one caveat. This will only work with guzzle7, which drupal/core-recommended:^9.5 does not support. However, using drupal/core directly will allow you to switch to guzzle7.

    Other than that, this presumably works fine with D10 (not yet tested by me) and on PHP8.1 (tested by me).

  • Status changed to Needs review over 1 year ago
  • πŸ‡³πŸ‡ΏNew Zealand dieuwe Auckland, NZ

    Switching to needs review instead of RTBC for now, and will come back to this once I have done more testing.

    I wonder if the dependencies for this module should be more permissive or is that a separate issue? (use ^ instead of ~)

  • πŸ‡³πŸ‡ΏNew Zealand xurizaemon Ōtepoti, Aotearoa 🏝

    Maybe try a ^6 || ^7 if Omnipay and Drupal versions have some intersections.

    Projects like Geocoder β†’ have done that ✨ Drupal 10 compatibility: changing php-http/guzzle6-adapter dependency into php-http/guzzle7-adapter RTBC for D10 upgrades.

  • πŸ‡³πŸ‡ΏNew Zealand dieuwe Auckland, NZ

    The problem is that the requirement for guzzle/guzzle7 is a hard requirement through the league/omnipay package. Drupal core 9.5 does have the multiple version ranges allowed (6 and 7).

    I think with D9 EOL so close and jumps to D10 needing to happen in the next few months this is probably a fine caveat.

    We could probably do "league/omnipay": "^3.0 || ^3.2", in commerce_dps to allow for both D9+D10 and PHP7+PHP8 support to co-exist for a bit longer.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    11 pass
  • @xurizaemon opened merge request.
  • @xurizaemon opened merge request.
  • πŸ‡³πŸ‡ΏNew Zealand xurizaemon Ōtepoti, Aotearoa 🏝

    Agreed, I see now that this works with drupal/core:^9.5 but the following are incompatible:

    • drupal/core-recommended:^9.5 (requires guzzlehttp/guzzle ~6.5.8)
    • league/omnipay (requires php-http/guzzle7-adapter ^1 which requires guzzlehttp/guzzle ^7.0)

    There are few apparent options, including omitting drupal/core-recommended, or (it seems?) replacing league/omnipay with omnipay/common.

    MR !11 seems to work with Drupal 10, CI on xurizaemon/commerce-demo shows it passing a payment transaction in Behat. Have not tested further than that.

    MR !13 here is just me seeing if there's a way to make the same change behave on D9, but I would accept merging a solution for D10 and leaving a release with the prior state for any D9 sites that need it.

    (If you're running Commerce DPS with D9 currently, please pop a hand up if we can improve the situation.)

  • πŸ‡³πŸ‡ΏNew Zealand xurizaemon Ōtepoti, Aotearoa 🏝

    I've merged this, having realised that a detail which was nagging at me was actually all in my head :D

    I trust that D9 sites will continue with whatever secret recipe they found to make it work in the meantime using dev releases.

    Thanks all for the effort (and patience).

  • Status changed to Fixed about 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024