Problem/Motivation
In User::preSave() we do:
$config = \Drupal::config('system.date');
if ($config->get('timezone.user.configurable') && !$this->getTimeZone() && !$config->get('timezone.user.default')) {
$this->set('timezone', $config->get('timezone.default'));
}
Steps to reproduce
But $config->get('timezone.user.default') is not a boolean - it is a tri-state switch using the \Drupal\user\UserInterface::TIMEZONE_DEFAULT, \Drupal\user\UserInterface::TIMEZONE_EMPTY and \Drupal\user\UserInterface::TIMEZONE_SELECT constants so let's use them here.
Proposed resolution
Use the constant in the if
Remaining tasks
User interface changes
None
Introduced terminology
N/a
API changes
N/a
Data model changes
None
Release notes snippet
N/a
Comments
Comment #2
alexpottI've gone for a loose comparison to match the existing if.
Comment #4
smustgrave commentedSeems straight forward enough!
Comment #5
astonvictor commentedthanks for the fix
+1 RTBC
Comment #6
catchCommitted/pushed to 11.x and cherry-picked to 11.3.x, thanks!