While updating to the latest Drupal core, I got this error after running drush updb:

PHP Fatal error: Declaration of Drupal\tfa\Controller\TfaUserControllerDeprecated::resetPassLogin($uid, $timestamp, $hash) must be compatible with Drupal\user\Controller\UserController::resetPassLogin($uid, $timestamp, $hash, Symfony\Component\HttpFoundation\Request $request) in /var/www/html/web/modules/contrib/tfa/src/Controller/TfaUserControllerDeprecated.php on line 15

Issue fork tfa-3592519

Command icon 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

joco_sp created an issue. See original summary.

joco_sp’s picture

I see that the src/Controller/TfaUserControllerDeprecated.php is used for the Drupal 9.2 and older, but it solved my issue and as I am not using a so old core, I am creating this patch, so that I can update my project.

Probably the mantainers of the module will find a better solution. Or maybe it is time to remove the support for 9.2 or older Drupal versions.

joco_sp’s picture

Status: Active » Needs review
cmlara’s picture

What version of Core and TFA were you upgrading from/to?
Did you run drush cr before drush updb?

https://git.drupalcode.org/project/tfa/-/blob/ffccb9eb012695cdef8d0a236e... is designed to control which version of the controller is loaded based on method signature, the incompatible class by design is intended to remain dormant on disk without being loaded into the executing code space (and thus not needing to be compatible with the conflicting signature).

joco_sp’s picture

Status: Needs review » Closed (works as designed)

I accidentally downloaded the 11.4-dev Drupal version :D Both drush cr and drush updb were giving me the error.
TFA version is 8.x-1.12.

I downgraded to the 11.3.11 Drupal version and I don't have this issue anymore.

I am marking it as "works as designed", because it works ok with the latest stable Drupal version and I am not sure what is the difference in 11.4-dev core that creates the issue.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

ltrain made their first commit to this issue’s fork.

ltrain’s picture

I confirm this throws the fatal in 11.4. I added a missing use Request statement to the MR.

ltrain’s picture

Status: Closed (works as designed) » Needs review
cmlara’s picture

Status: Needs review » Needs work

As noted in comment 5 the class should never load into memory, the proper solution is to investigate why the route is being set to the deprecated class.

Changing the signature is not a valid solution.

I can confirm I did see this in a quick dev lab setup on 11.4, did not see the cause to be immediately apparent.

cmlara’s picture

Just recalled I had heard talk about core considering to add Attribute based route processing.

https://www.drupal.org/node/3311365 would be a likely candidate for cause.

cmlara’s picture