If site timezone is invalid, users can't be created, but error provides no information

Created on 17 June 2021, about 3 years ago
Updated 24 January 2023, over 1 year ago

Problem/Motivation

If for some reason your site's timezone is invalid, and the timezone selection field is not enabled per user, you can't create new users or update any existing users whose timezone is NULL. This is not unexpected but the error contains no useful information for debugging: "The value you selected is not a valid choice" and there is no error in the form.

In my case we migrated from a site that had a custom timezone set ('Australia/Canberra') and this setting was migrated to the new site. But since this timezone doesn't exist, all users were migrated with a NULL timezone and new users could not be created.

This is fixed very easily by setting a valid timezone, and the issue doesn't occur even with an invalid timezone if 'Users may set their own timezone' is selected.

This is such an edge case that I'm not even sure whether it should be fixed but I thought I would make the issue in case it helps someone else.

Steps to reproduce

  1. Install Drupal
  2. Import configuration with an invalid timezone, e.g. 'Australia/Canberra', and with configurable: false
  3. Try to create a user, see this error:
  4. Import config again with invalid timezone and with configurable: true
  5. Try to create a user, it works even with no timezone set

Proposed resolution

Catch this error and provide useful feedback about it.

Remaining tasks

  1. Decide whether to fix
  2. Patch with tests
  3. Review

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

πŸ› Bug report
Status

Closed: won't fix

Version

10.1 ✨

Component
User moduleΒ  β†’

Last updated 1 day ago

Created by

πŸ‡¦πŸ‡ΊAustralia pameeela

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • Status changed to Closed: won't fix over 1 year ago
  • πŸ‡¦πŸ‡ΊAustralia pameeela

    Marking this won't fix on myself, I think it's been long enough! Given that this can only occur with invalid configuration, I don't think it needs to be addressed. But still the report may help someone someday :)

Production build 0.71.5 2024