Problem/Motivation
When user not logged in, there is a warning: (drupal8-beta9)
Warning: DateTime::createFromFormat(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Drupal\Core\EventSubscriber\FinishResponseSubscriber->setExpiresNoCache() (line 252 of core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php).
Proposed resolution
Hide the warning.
Reference, for valid/invalid timezones:
http://php.net/manual/en/timezones.others.php
Remaining tasks
Review patch, or find a better solution to fix this issue.
User interface changes
None.
API changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | default_timezone-2471405-3.patch | 719 bytes | tompagabor |
Comments
Comment #1
tompagabor commentedComment #2
tompagabor commentedComment #3
tompagabor commentedMaybe enough to change GMT to UTC.
Please review.
Comment #4
gaëlgLast patch removed the warning from my local install.
Comment #6
alexpottMakes sense. This issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed 3684dd2 and pushed to 8.0.x. Thanks!
Comment #7
znerol commentedI think the warning message has been misinterpreted in that case. This warning is triggered if the
date.timezoneini value is not configured and ifdate_default_timezone_set()has not been called before any date/time format function.We call
date_default_timezone_set()from withinAccountProxy::setAccount. This changed in #2328645: Remove remaining global $user, before we called that function always from withinSessionManager::start(). Also note that since #2228393: Decouple session from cookie based user authentication we do not callAccountProxy::setAccount()for anonymous users anymore.Please note that you get this warning if your PHP environment is not properly configured. This is not something which could be fixed in Drupal. Also note that specifying
UTCinstead ofGMTis not allowed in HTTP header timestamps (see also #1918820: HTTP header date formats). I guess that the Symfony response will take care and reformat that properly before it is sent to the client.