Problem/Motivation

Our tests fail with this error:Schema errors for password_policy.password_policy.dvg_policy with the following errors: password_policy.password_policy.dvg_policy:send_reset_email variable type is integer but applied schema class is Drupal\Core\TypedData\Plugin\DataType\BooleanData

I think this is because in PasswordPolicy.php the variable is defined as an int:

 /**
   * Send email notification upon reset.
   *
   * @var int
   */
  protected $send_reset_email = 0;
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

JoshaHubbers created an issue. See original summary.

joshahubbers’s picture

Version: 8.x-3.2 » 8.x-3.x-dev
Status: Active » Needs review
StatusFileSize
new492 bytes

This patch fixes the issue.

lucassc’s picture

StatusFileSize
new813 bytes
new384 bytes

Fixing getPasswordResetEmailValue() function return as well.

gquisini’s picture

Assigned: Unassigned » gquisini
gquisini’s picture

Assigned: gquisini » Unassigned
Status: Needs review » Reviewed & tested by the community

Well, that seems to be right. I applied the patch successfully, but I couldn't test it to see if the error was resolved.

PS: If anyone has any tips on how I can test it, I would be happy to review it again.

gquisini’s picture

Status: Reviewed & tested by the community » Needs review
lucassc’s picture

Status: Needs review » Reviewed & tested by the community

I think the tests are from @JoshaHubbers' pipeline. As he already confirmed the patch solves the issue and we have checked the changes in the code and validated they are correct and make sense, I think it can be marked as RTBC if no one else disagrees.

Please change status otherwise.

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

rajeshreeputra’s picture

+1 RTBC, Created MR for ease.

kristen pol’s picture

Assigned: Unassigned » kristen pol

Assigning to myself as I'm reviewing/merging ready RTBC fixes/updates over the next few days.

kristen pol’s picture

The MR is nothing like the patch. I'm going to just look at the patch as that is what was RTBC'ed.

kristen pol’s picture

Assigned: kristen pol » Unassigned
Issue tags: +Needs steps to reproduce

#3 applies cleanly to the 4.0.x branch. But, I'm not sure how to get the error that is being reported.

Postponing for steps to reproduce.

kristen pol’s picture

Assigned: Unassigned » kristen pol
Issue tags: -Needs steps to reproduce

Actually, I see the schema is:

    send_reset_email:
      type: boolean
      label: 'Password reset send email'

so this change makes sense. Assigning back to me.

kristen pol’s picture

Status: Reviewed & tested by the community » Needs work

I checked the code and it looks like there's one remaining place to change:

  private function transformV1(array &$value) {
    $value['label'] = $value['name'];
    $value['password_reset'] = $value['expiration'];
    $value['send_reset_email'] = ($value['warning'] !== 0) ? 1 : 0;

kristen pol’s picture

Version: 8.x-3.x-dev » 4.0.0
Assigned: kristen pol » Unassigned
Status: Needs work » Fixed

Thanks to everyone for the work on this issue. The fix has been updated and merged and will be part of the next release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

kristen pol’s picture

Version: 4.0.0 » 4.0.x-dev

This is part of the new 4.0.1 release.