- Issue created by @adr_p
- Status changed to Needs review
almost 2 years ago 9:12am 20 February 2023 - 🇮🇳India Arun Velusamy
I have verified the patch #2 and tested it on Drupal version 9.5.x. The patch works fine and I have added the before and after screenshots for reference.
- 🇬🇧United Kingdom adamps
Thanks for the report. The patch doesn't apply however it showed a good direction. I tested and changed it slightly to work in all cases I could think of.
We've had a series of bugs many of them caused by bad fixes to previous bugs:
- This was caused by #3311553: Non-visible roles are removed →
- #3172576: Admin user cannot bulk add/remove roles when using VBO →
- #3292173: Roles no longer visible on user_form since 3.1.0 release → was caused by #3188812: Module overrides previously set #access on roles form element →
It would if someone could write a test for roles, including as many of the above cases as possible.
- Status changed to RTBC
over 1 year ago 1:03pm 14 April 2023 - 🇨🇦Canada sagesolutions
I successfully applied patch #4 and can now remove (and add) roles when editing users.
I agree that tests should be added to prevent regression issues
- 🇬🇧United Kingdom adamps
Thanks. I've committed the fix and raised 📌 Add tests for roles Active .
- Status changed to Needs review
over 1 year ago 7:40am 26 April 2023 - last update
over 1 year ago 1 pass - 🇷🇺Russia a.kovrigin Penza
It can be a situation, when there is no roles key in $form['account'] array on form submission which causes the fatal error.
The patch fixes the issue. - Status changed to Fixed
over 1 year ago 1:28pm 26 April 2023 - 🇬🇧United Kingdom adamps
It can be a situation, when there is no roles key in $form['account'] array on form submission which causes the fatal error.
How would that be? The roles field is always set in AccountForm. If a module wishes to remove the field from display they should use the '#access'. Removing the array key entirely could cause bugs in other modules too.
The patch fixes the issue.
This issue has already been fixed, and I've made a release, so I can't make a new commit here without causing confusion. As far as I can see, the same problem was true before this fix. So please raise a new issue if you wish to continue the discussion.
Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
over 1 year ago 8:25am 3 July 2023 - 🇧🇪Belgium siemen_hermans
The changes introduced by this fix can lead to a TypeError in the array_diff function.
In our specific situation the user can only have 1 role. As a result$form['account']['roles']['#default_value']
returns a string.
This causes a TypeError in the array_diff function.A simple check of the value returned by
$form['account']['roles']['#default_value']
could resolve the issue.