Problem/Motivation
E.g. https://www.drupal.org/pift-ci-job/620182
Failing tests:
User.Drupal\user\Tests\UserTimeZoneTest
✗ testUserTimeZone
fail: [Other] Line 67 of core/modules/user/src/Tests/UserTimeZoneTest.php:
Date should be Chile summer time; five hours ahead of PST.fail: [Other] Line 69 of core/modules/user/src/Tests/UserTimeZoneTest.php:
Date should be Chile time; four hours ahead of PSTfail: [Other] Line 71 of core/modules/user/src/Tests/UserTimeZoneTest.php:
Date should be Chile time; three hours ahead of PDT.
@mpdonadio mentioned that there was a recent change to Chile's timezone rules. This may be an actual bug in HEAD as the assertion in question is for a date in 2007, and Chile's timezone rules have actually changed a few times since then.
Proposed resolution
Fix HEAD or the test, depending.
Remaining tasks
TBD
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#17 | interdiff-12-17.txt | 911 bytes | mpdonadio |
#17 | 2860663-17.patch | 3.48 KB | mpdonadio |
#12 | 2860663-12.patch | 3.04 KB | mpdonadio |
Comments
Comment #2
xjmComment #3
mpdonadioIs this constantly failing, or intermittent?
I think we need to do two things:
1. Either on admin/reports/status or admin/config/regional/settings, we need to output the results of `timezone_version_get()`. I suspect these dev versions of PHP are using the newer timezonedb that have the Chile change. This should also be logged in a test (UserTimeZoneTest may be best here).
2. Short term we should change UserTimeZoneTest to use a different TZ that observes DST (to fix the critical). Long term, we should standardize the zone we use throughout tests, unless we are explicitly testing something and have picked the zones for particular reasons (eg, the TZ loop in the datatime field tests). Not to be US centric, but I think we should pick America/New_York, which maps to the North American Eastern Time Zone (I can't recall the official letter designation), and that book is at home). It observes DST, is far enough from UTC to show problems where there is a glitch, and I think these is less chance of another local change (which is my fear with choosing something outside the US).
For reference this is the database, https://github.com/eggert/tz, but work/changes are discussed on the tz mailing list (patches are posted to the list, they don't do pull requests).
Comment #4
heddnhttps://www.drupal.org/pift-ci-job/624542
Comment #5
mpdonadioJust something so we have test runs on this issue.
Comment #6
mpdonadioComment #8
mpdonadioThis is in the notes for 2017a:
I think this is the problem, but I need to figure out a way to arbiltrarilly swap the PHP zoneinfo locally to test this.
Comment #9
mpdonadioComment #10
xjmThis will fix the failure by avoiding the problem, but aren't we eliminating coverage? Shouldn't user DST tests test exactly all the edge cases of DST for users all over the world, not just the North American ones? The reason Chile is being used is that it is the same longitude as LA but opposite latitude, so it is a good case of southern hemisphere. If we're replacing it because Chile is not reliable, can we replace it with something else in the southern hemisphere?
I guess this is discussed in #3. If we go the route of hotfixing HEAD and then fixing our specialer-case DST support and testing in a followup major, let's file it now and put it in @todos in the patch.
FWIW, his test dates to #11077: Introduce Daylight Saving Time for Drupal which was committed in 2008.
Comment #11
mpdonadioStill haven't gotten the 2017a zoneinfo working locally. Hopefully this will confirm my suspicions.
Comment #12
mpdonadioHere is an idea that we can keep the locations, but test the same things. Once I see the results from #11 and #12, I'll post a writeup.
Comment #13
mpdonadioOk, here is essentially what happened.
In the 2017a zoneinfo file which the 7-dev PHP branches are using, local zone names started to be replaced with numeric designations, because of a change in one of the local time zone rules.
So
became
This is what caused the test fail: the 'T' placeholder is generating a different value for 2017a.
So, if we want to keep these test cases, but effectively test the same thing, we can use the 'I' placeholder, which is 1 when DST is being observed, and 0 if not (see #12). That will keep the spirit of the test; in fact you could argue that this is better because we are explicitly testing DST not implicitly testing it through what the abbreviations mean.
I'll try to find the thread about this change on the TZ mailing list for reference.
If you want to see what zoneinfo is used in which version, you can checkout https://3v4l.org/3sEMa, but that doesn't have the dev tips.
Comment #15
cilefen CreditAttribution: cilefen commented@alexpott, @catch, @cottser, @xjm and I considered this issue and agree this is suitably a critical priority bug test failures in HEAD interrupt the work of project contributors.
Comment #16
Mile23I can confirm that the patch in #12 applies, passes locally on MAMP with PHP 7.0 (not dev), and PHP 5.6.
Just one thing:
There should be a comment explaining why we chose this pattern. Basically explaining #13.
Also out of scope here:
Comment #17
mpdonadioHere is an attempt at a comment.
Comment #18
Mile23Diggit. LGTM. Unfortunately I don't have a way to repro locally, but the testbot looks happy.
Comment #19
alexpottCommitted and pushed fc3d289 to 8.4.x and be0f298 to 8.3.x. Thanks!
Nice fix that preserves the existing coverage - mpdonadio++
Comment #22
xjmComment #24
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedThis is causing test failures in Drupal 7 too, so here's an issue to backport it: #2880700: [D7] UserTimeZoneFunctionalTest fails on recent versions of PHP 7 and 7.1