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
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 #2
joco_sp commentedI see that the
src/Controller/TfaUserControllerDeprecated.phpis 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.
Comment #4
joco_sp commentedComment #5
cmlaraWhat version of Core and TFA were you upgrading from/to?
Did you run
drush crbeforedrush 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).
Comment #6
joco_sp commentedI 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.
Comment #9
ltrainI confirm this throws the fatal in 11.4. I added a missing use Request statement to the MR.
Comment #10
ltrainComment #11
cmlaraAs 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.
Comment #12
cmlaraJust 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.
Comment #13
cmlaraPostponed on Core issue #3592887: AttributeRouteDiscovery dos not cleanly handle invalid classes