Problem/Motivation
The current composer.json for drupal/tfa restricts paragonie/constant_time_encoding to ^1.0 || ^2.0. This causes Composer conflicts in projects that already require v3, such as those based on drupal/recommended-project with Drupal core 10.2.0 or later. The conflict prevents installation of tfa 1.12.0, but Composer does not report this directly — the update is silently skipped unless you run composer why-not or composer require --dry-run.
Proposed resolution
Update the version constraint to:
"paragonie/constant_time_encoding": "^1.0 || ^2.0 || ^3.0"This allows compatibility with modern Drupal setups while preserving support for older PHP versions.
Steps to reproduce
- Use a project based on
drupal/recommended-projectwith Drupal core 10.2.0 or later - Ensure the project requires
paragonie/constant_time_encoding:^3.0 - Run
composer update drupal/tfa --with-all-dependencies - Observe that the update to
tfa 1.12.0is silently skipped - Run
composer why-not drupal/tfa 1.12.0orcomposer require "drupal/tfa:1.12.0" --dry-runto reveal the version conflict
Justification
- The
Encodingclass and methods used bytfaare unchanged in v3 - Manual inspection confirms compatibility
- This change unblocks Composer updates and avoids unnecessary conflicts
Related issues
- #3498141: Previous Composer conflict due to missing dependency declaration
Issue fork tfa-3551511
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
seeduardo commentedComment #6
seeduardo commentedComment #7
cmlaraLooking at a new project created as described and
drupal/recommended-projectdoes not appear to requireparagonie/constant_time_encodingor block ^2. This appears to be normal composer operations and local constraint conflicts by adding an additional conflict in step 2 of the reproduction example.christian-riesen/otp >= 2.4.0only supports^1 || ^2.^3would lock back tochristian-riesen/otp:2.3.0(see https://git.drupalcode.org/issue/tfa-3551511/-/jobs/6875247#L88 ).While we support the older API I'm not sure we want TFA "encouraging" composer to allow this rollback when we would want to prefer the newer versions.
At a minimal we would want the tests to use
^2.7.This does point out another reason that having the plugins not be part of the main TFA library would allow more flexibility (ref: #3353326: Remove TOTP/HOTP plugins from TFA module (adding was a regression) )
I'm inclined to believe we should won't-fix this unless
christian-riesen/otphas plans to support ^3.I will additionally note our 2.x branch will not depend upon either of these packages directly.