UserPasswordForm Argument #5 TypeError

Created on 20 January 2025, about 1 month ago

Problem/Motivation

TypeError: Drupal\user\Form\UserPasswordForm::__construct(): Argument #5 ($userNameValidator) must be of type Drupal\user\UserNameValidator, Drupal\Core\TypedData\TypedDataManager given, called in /home/www-data/public_html/modules/contrib/user_registrationpassword/user_registrationpassword.module on line 524 in Drupal\user\Form\UserPasswordForm->__construct() (line 71 of core/modules/user/src/Form/UserPasswordForm.php).
_user_registrationpassword_user_pass_validate()

Steps to reproduce

In a Drupal 11 project go on the Reset your password (/user/password) page and submit the form.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡·πŸ‡ΈSerbia norbert-goco Subotica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @norbert-goco
  • πŸ‡·πŸ‡ΈSerbia norbert-goco Subotica

    I've created a patch for Drupal 11.

  • πŸ‡¬πŸ‡§United Kingdom jeremyskinner

    We've also run into the same issue, however the solution in this patch #2 isn't correct,.

    Although this patch will fix the issue for Drupal 11, it will then cause failures under Drupal 10 which is a breaking change as user_registrationpassword supports both 10 and 11.

    The correct way to handle this is to do a core version check and perform different calls depending on the core version. My colleage will provide an updated patch shortly.

  • πŸ‡¬πŸ‡§United Kingdom mjb3141

    Updated Patch to perform a core version check.

  • πŸ‡¬πŸ‡§United Kingdom joehuggans Harrogate, UK

    joe huggans β†’ made their first commit to this issue’s fork.

  • Merge request !14Initial commit from patch #4 β†’ (Open) created by Unnamed author
  • Pipeline finished with Failed
    22 days ago
    Total: 311s
    #412601
  • Pipeline finished with Failed
    22 days ago
    Total: 241s
    #412614
  • Pipeline finished with Failed
    22 days ago
    Total: 1043s
    #412617
  • πŸ‡¬πŸ‡§United Kingdom joehuggans Harrogate, UK

    Created MR with patch from #4, and corrected some phpcs stuff.

    The 2 tests that are failing are already failing in the same points before this patch is applied, not sure what the module maintainers want to do about this? Do we need a new issue to fix these? Or is there one already open that I missed?

    Tested in Drupal 10 and no error occurs when resetting password.

Production build 0.71.5 2024