New user save with no terms causes WSOD

Created on 21 September 2023, about 1 year ago
Updated 12 October 2023, about 1 year ago

Saving a new user who has no PbT associations (the "terms" field in their account is blank) produces the following exception:

Uncaught PHP Exception TypeError: "array_diff(): Argument #2 must be of type array, string given" at ...\modules\contrib\permissions_by_term\permissions_by_term.module line 312

Code in question is:

  // Rebuild permissions for nodes if needed.
  $origTerms = $form['access']['terms']['#default_value'] ?? [];
  $newTerms = $form_state->getValue('terms');  <--- returns "", not an array
  $changes = array_diff($origTerms, $newTerms) + array_diff($newTerms, $origTerms);  <--- failure here

Patch follows

🐛 Bug report
Status

Fixed

Version

3.1

Component

Code

Created by

🇨🇦Canada _randy

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

Comments & Activities

Production build 0.71.5 2024