Bug #23763 New

Timezone Setting Sets to UTC Instead of Config Default

Version: 4.3.3 Reporter: TJ Draper

On line 297 of system/ee/legacy/libraries/Core.php the timezone is set to the timezone setting in userdata unless there is no userdata timezone, in which case it goes to the default config timezone.

EXCEPT…

The second argument of ee()->session->userdata()to specify what to fall back to checks if the item is set, not if it’s a falsy value. On an EE 2 site I updated to EE 4, most of the user’s timezone userdata is set to an empty string. Hence, because of the conditional on line 300, we wind up with UTC as the default. This seems like a bug to me as, if the timezone does not exist on the userdata (and empty string should indicate it does not exist), then it should fall back to the site default.

Changing line 297 to the following yields the correct results here:

php
$timezone = ee()->session->userdata('timezone') ?: ee()->config->item('default_site_timezone');
  • Nobody has said anything yet.

You must be signed in to comment on a bug report.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases